(function(exports,main_core_events,ui_cnt,main_core){"use strict";(function(){BX.namespace("BX.Grid");BX.Grid.ActionPanel=function(t,e,i){this.parent=null;this.rel={};this.actions=null;this.types=null;this.lastActivated=[];this.init(t,e,i);this.button=[];this.elements=[];this.buttonOnChange=[];this.buttonData={}};BX.Grid.ActionPanel.prototype={init:function init(parent,actions,types){this.parent=parent;this.actions=eval(actions);this.types=eval(types);BX.addCustomEvent(window,"Dropdown::change",BX.proxy(this._dropdownEventHandle,this));BX.addCustomEvent(window,"Dropdown::load",BX.proxy(this._dropdownEventHandle,this));var panel=this.getPanel();BX.bind(panel,"change",BX.delegate(this._checkboxChange,this));BX.bind(panel,"click",BX.delegate(this._clickOnButton,this));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this._gridUpdatedEventHandle,this))},destroy:function t(){BX.removeCustomEvent(window,"Dropdown::change",BX.proxy(this._dropdownEventHandle,this));BX.removeCustomEvent(window,"Dropdown::load",BX.proxy(this._dropdownEventHandle,this));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this._gridUpdatedEventHandle,this))},_gridUpdatedEventHandle:function t(){var e=BX("grid_cancel_button");e&&BX.fireEvent(BX.firstChild(e),"click")},_dropdownEventHandle:function t(e,i,n,s){this.isPanelControl(BX(e))&&this._dropdownChange(e,i,n,s)},resetForAllCheckbox:function t(){var e=this.getForAllCheckbox();if(BX.type.isDomNode(e)){e.checked=null}},getForAllCheckbox:function t(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classForAllCheckbox"),true)},getPanel:function t(){return BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classActionPanel"),true)},getApplyButton:function t(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelApplyButton"),true)},isPanelControl:function t(e){return BX.hasClass(e,this.parent.settings.get("classPanelControl"))},getTextInputs:function t(){return BX.Grid.Utils.getBySelector(this.getPanel(),'input[type="text"]')},getHiddenInputs:function t(){return BX.Grid.Utils.getBySelector(this.getPanel(),'input[type="hidden"]')},getSelects:function t(){return BX.Grid.Utils.getBySelector(this.getPanel(),"select")},getDropdowns:function t(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classDropdown"))},getCheckboxes:function t(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelCheckbox"))},getButtons:function t(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelButton"))},isDropdown:function t(e){return BX.hasClass(e,this.parent.settings.get("classDropdown"))},isCheckbox:function t(e){return BX.hasClass(e,this.parent.settings.get("classPanelCheckbox"))},isTextInput:function t(e){return e.type==="text"},isHiddenInput:function t(e){return e.type==="hidden"},isSelect:function t(e){return e.tagName==="SELECT"},createDropdown:function t(e,i){var n=e.EMPTY_TEXT||"";var s=e.MULTIPLE==="Y";var a=this.createContainer(e.ID,i,{});var r=BX.create("div",{props:{className:"main-dropdown main-grid-panel-control",id:e.ID+"_control"},attrs:{name:e.NAME,"data-name":e.NAME,"data-empty-text":n,"data-multiple":s?"Y":"N","data-items":JSON.stringify(e.ITEMS),"data-value":s?"":e.ITEMS[0].VALUE,"data-popup-position":"fixed"},children:[BX.create("span",{props:{className:"main-dropdown-inner"},html:s?n:e.ITEMS[0].NAME})]});a.appendChild(r);return a},createCheckbox:function t(e,i){var n=this.createContainer(e.ID,i,{});var s=BX.create("span",{props:{className:"main-grid-checkbox-container"}});var a=BX.create("span",{props:{className:"main-grid-control-panel-content-title"}});var r=BX.create("input",{props:{type:"checkbox",className:this.parent.settings.get("classPanelCheckbox")+" main-grid-checkbox",id:e.ID+"_control"},attrs:{value:e.VALUE||"",title:e.TITLE||"",name:e.NAME||"","data-onchange":JSON.stringify(e.ONCHANGE)}});r.checked=e.CHECKED||null;n.appendChild(s);n.appendChild(a);s.appendChild(r);s.appendChild(BX.create("label",{props:{className:"main-grid-checkbox"},attrs:{for:e.ID+"_control",title:e.TITLE}}));a.appendChild(BX.create("label",{attrs:{for:e.ID+"_control",title:e.TITLE},html:e.LABEL}));return n},createText:function t(e,i){var n=this.createContainer(e.ID,i,{});var s=BX.type.isNotEmptyString(e["TITLE"])?e["TITLE"]:"";if(s!==""){n.appendChild(BX.create("label",{attrs:{title:s,for:e.ID+"_control"},text:s}))}n.appendChild(BX.create("input",{props:{className:"main-grid-control-panel-input-text main-grid-panel-control",id:e.ID+"_control"},attrs:{name:e.NAME,title:s,placeholder:e.PLACEHOLDER||"",value:e.VALUE||"",type:"text","data-onchange":JSON.stringify(e.ONCHANGE||[])}}));return n},createHidden:function t(e,i){var n=this.createContainer(e.ID,i,{CLASS:"main-grid-panel-hidden-control-container"});n.appendChild(BX.create("input",{props:{id:e.ID+"_control",type:"hidden"},attrs:{name:e.NAME,value:e.VALUE||""}}));return n},createButton:function t(e,i){this.buttonOnChange=e.ONCHANGE||[];this.buttonData=e;this.button=this.createButtonNode(e);BX.removeCustomEvent(window,"Grid::unselectRow",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::selectRow",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::allRowsSelected",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this.prepareButton,this));if(this.buttonData.SETTINGS&&e.ID===this.buttonData.SETTINGS.buttonId){BX.addCustomEvent(window,"Grid::unselectRow",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::selectRow",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::allRowsSelected",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this.prepareButton,this))}this.prepareButton();var n=this.createContainer(e.ID,i,{});n.appendChild(this.button);return n},createButtonNode:function t(e){return BX.create("button",{props:{className:"main-grid-buttons"+(e.CLASS?" "+e.CLASS:""),id:e.ID+"_control",title:BX.type.isNotEmptyString(e.TITLE)?e.TITLE:""},attrs:{name:e.NAME||""},html:e.TEXT})},prepareButton:function t(){if(this.isSetButtonDisabled()){BX.Dom.attr(this.button,"data-onchange",[]);BX.Dom.addClass(this.button,"ui-btn ui-btn-disabled")}else{BX.Dom.attr(this.button,"data-onchange",this.buttonOnChange);BX.Dom.removeClass(this.button,"ui-btn ui-btn-disabled")}},isSetButtonDisabled:function t(){return!!(this.buttonData.SETTINGS&&this.buttonData.SETTINGS.minSelectedRows&&this.getSelectedIds().length<this.buttonData.SETTINGS.minSelectedRows)},createLink:function t(e,i){var n=this.createContainer(e.ID,i,{});var s=BX.create("a",{props:{className:"main-grid-link"+(e.CLASS?" "+e.CLASS:""),id:e.ID+"_control"},attrs:{href:e.HREF||"","data-onchange":JSON.stringify(e.ONCHANGE||[])},html:e.TEXT});n.appendChild(s);return n},createCustom:function t(e,i){var n=this.createContainer(e.ID,i,{CLASS:"main-grid-panel-hidden-control-container"});var s=BX.create("div",{props:{className:"main-grid-panel-custom"+(e.CLASS?" "+e.CLASS:"")},html:e.VALUE});n.appendChild(s);return n},createContainer:function t(e,i,n){e=e.replace("_control","");i=i.replace("_control","");n=n||{};return BX.create("span",{props:{className:this.parent.settings.get("classPanelControlContainer")+(n.CLASS?" "+n.CLASS:""),id:e},attrs:{"data-relative":i}})},removeItemsRelativeCurrent:function t(e){var i=e;var n=[e.id];var s=[];var a;while(i){a=BX.data(i,"relative");if(n.includes(a)){n.push(i.id);s.push(i)}i=i.nextElementSibling}s.forEach((function(t){BX.remove(t)}))},validateData:function t(e){return"ONCHANGE"in e&&BX.type.isArray(e.ONCHANGE)},activateControl:function t(e){var i=BX(e);if(BX.type.isDomNode(i)){BX.removeClass(i,this.parent.settings.get("classDisable"));i.disabled=null}},deactivateControl:function t(e){var i=BX(e);if(BX.type.isDomNode(i)){BX.addClass(i,this.parent.settings.get("classDisable"));i.disabled=true}},showControl:function t(e){var i=BX(e);i&&BX.show(i)},hideControl:function t(e){var i=BX(e);i&&BX.hide(i)},validateActionObject:function t(e){return BX.type.isPlainObject(e)&&"ACTION"in e&&BX.type.isNotEmptyString(e.ACTION)&&(e.ACTION===this.actions.RESET_CONTROLS||"DATA"in e&&BX.type.isArray(e.DATA))},validateControlObject:function t(e){return BX.type.isPlainObject(e)&&"TYPE"in e&&"ID"in e},createDate:function t(e,i){var n=this.createContainer(e.ID,i,{});var s=BX.decl({block:"main-ui-date",mix:["main-grid-panel-date"],calendarButton:true,valueDelete:true,placeholder:"PLACEHOLDER"in e?e.PLACEHOLDER:"",name:"NAME"in e?e.NAME+"_from":"",tabindex:"TABINDEX"in e?e.TABINDEX:"",value:"VALUE"in e?e.VALUE:"",enableTime:"TIME"in e?e.TIME?"true":"false":"false"});n.appendChild(s);return n},createControl:function t(e,i){var n=null;switch(e.TYPE){case this.types.DROPDOWN:n=this.createDropdown(e,i);break;case this.types.CHECKBOX:n=this.createCheckbox(e,i);break;case this.types.TEXT:n=this.createText(e,i);break;case this.types.HIDDEN:n=this.createHidden(e,i);break;case this.types.BUTTON:n=this.createButton(e,i);break;case this.types.LINK:n=this.createLink(e,i);break;case this.types.CUSTOM:n=this.createCustom(e,i);break;case this.types.DATE:n=this.createDate(e,i);break}return n},onChangeHandler:function onChangeHandler(container,actions,isPseudo){var newElement,callback;var self=this;if(BX.type.isDomNode(container)&&BX.type.isArray(actions)){actions.forEach((function(action){if(self.validateActionObject(action)){if(action.ACTION===self.actions.CREATE){self.removeItemsRelativeCurrent(container);action.DATA.reverse();action.DATA.forEach((function(t){if(self.validateControlObject(t)){newElement=self.createControl(t,container.id||BX.data(container,"relative"));if(BX.type.isDomNode(newElement)){BX.insertAfter(newElement,container);if("ONCHANGE"in t&&t.TYPE===self.types.CHECKBOX&&"CHECKED"in t&&t.CHECKED){self.onChangeHandler(newElement,t.ONCHANGE)}if(t.TYPE===self.types.DROPDOWN&&BX.type.isArray(t.ITEMS)&&t.ITEMS.length&&"ONCHANGE"in t.ITEMS[0]&&BX.type.isArray(t.ITEMS[0].ONCHANGE)){self.onChangeHandler(newElement,t.ITEMS[0].ONCHANGE)}}}}))}if(action.ACTION===self.actions.ACTIVATE){self.removeItemsRelativeCurrent(container);if(BX.type.isArray(action.DATA)){action.DATA.forEach((function(t){self.lastActivated.push(t.ID);self.activateControl(t.ID)}))}}if(action.ACTION===self.actions.SHOW){if(BX.type.isArray(action.DATA)){action.DATA.forEach((function(t){self.showControl(t.ID)}))}}if(action.ACTION===self.actions.HIDE){if(BX.type.isArray(action.DATA)){action.DATA.forEach((function(t){self.hideControl(t.ID)}))}}if(action.ACTION===self.actions.HIDE_ALL_EXPECT){if(BX.type.isArray(action.DATA)){(self.getControls()||[]).forEach((function(t){if(!action.DATA.some((function(e){return e.ID===t.id}))){self.hideControl(t.id)}}))}}if(action.ACTION===self.actions.SHOW_ALL){(self.getControls()||[]).forEach((function(t){self.showControl(t.id)}))}if(action.ACTION===self.actions.REMOVE){if(BX.type.isArray(action.DATA)){action.DATA.forEach((function(t){BX.remove(BX(t.ID))}))}}if(action.ACTION===self.actions.CALLBACK){this.confirmDialog(action,BX.delegate((function(){if(BX.type.isArray(action.DATA)){action.DATA.forEach((function(currentCallback){if(currentCallback.JS.indexOf("Grid.")!==-1){callback=currentCallback.JS.replace("Grid","self.parent");callback=callback.replace("()","");callback+=".apply(self.parent, [container])";try{eval(callback)}catch(t){throw new Error(t)}}else if(BX.type.isNotEmptyString(currentCallback.JS)){try{eval(currentCallback.JS)}catch(t){throw new Error(t)}}}))}}),this))}if(action.ACTION===self.actions.RESET_CONTROLS){this.removeItemsRelativeCurrent(container)}}}),this)}else{if(!isPseudo){this.removeItemsRelativeCurrent(container)}self.lastActivated.forEach((function(t){self.deactivateControl(t)}));self.lastActivated=[]}},confirmDialog:function t(e,i,n){this.parent.confirmDialog(e,i,n)},_dropdownChange:function t(e,i,n,s){var a=BX(e);var r=a.parentNode;var o=s&&"ONCHANGE"in s?s.ONCHANGE:null;var l=s&&"PSEUDO"in s&&s.PSEUDO!==false;this.onChangeHandler(r,o,l)},_checkboxChange:function _checkboxChange(event){var onChange;try{onChange=eval(BX.data(event.target,"onchange"))}catch(t){onChange=null}this.onChangeHandler(BX.findParent(event.target,{className:this.parent.settings.get("classPanelContainer")},true,false),event.target.checked||event.target.id.indexOf("actallrows_")!==-1?onChange:null)},_clickOnButton:function _clickOnButton(event){var onChange;if(this.isButton(event.target)){event.preventDefault();try{onChange=eval(BX.data(event.target,"onchange"))}catch(t){onChange=null}this.onChangeHandler(BX.findParent(event.target,{className:this.parent.settings.get("classPanelContainer")},true,false),onChange)}},isButton:function t(e){return BX.hasClass(e,this.parent.settings.get("classPanelButton"))},getSelectedIds:function t(){var e=this.parent.getRows().getSelected().filter((function(t){return t.isShown()}));return e.map((function(t){return t.getId()}))},getControls:function t(){return BX.findChild(this.getPanel(),{className:this.parent.settings.get("classPanelControlContainer")},true,true)},getValues:function t(){var e={};var i=this;var n=[].concat(this.getDropdowns(),this.getTextInputs(),this.getHiddenInputs(),this.getSelects(),this.getCheckboxes(),this.getButtons());(n||[]).forEach((function(t){if(BX.type.isDomNode(t)){if(i.isDropdown(t)){var n=BX.data(t,"value");var s=BX.data(t,"multiple")==="Y";n=n!==null&&n!==undefined?n:"";e[BX.data(t,"name")]=s?n.split(","):n}if(i.isSelect(t)){e[t.getAttribute("name")]=t.options[t.selectedIndex].value}if(i.isCheckbox(t)&&t.checked){e[t.getAttribute("name")]=t.value}if(i.isTextInput(t)||i.isHiddenInput(t)){e[t.getAttribute("name")]=t.value}if(i.isButton(t)){var a=BX.data(t,"name");var r=BX.data(t,"value");r=r!==null&&r!==undefined?r:"";if(a){e[a]=r}}}}));return e}}})();(function(){BX.namespace("BX.Grid");BX.Grid.BaseClass=function(t){this.parent=t};BX.Grid.BaseClass.prototype={getParent:function t(){return this.parent}}})();(function(){BX.namespace("BX.Grid");BX.Grid.ColsSortable=function(t){this.parent=null;this.dragItem=null;this.targetItem=null;this.rowsList=null;this.colsList=null;this.dragRect=null;this.offset=null;this.startDragOffset=null;this.dragColumn=null;this.targetColumn=null;this.isDrag=null;this.init(t)};BX.Grid.ColsSortable.prototype={init:function t(e){this.parent=e;this.colsList=this.getColsList();this.rowsList=this.getRowsList();if(!this.inited){this.inited=true;BX.addCustomEvent("Grid::updated",BX.proxy(this.reinit,this));BX.addCustomEvent("Grid::headerUpdated",BX.proxy(this.reinit,this))}this.registerObjects()},destroy:function t(){BX.removeCustomEvent("Grid::updated",BX.proxy(this.reinit,this));this.unregisterObjects()},reinit:function t(){this.unregisterObjects();this.reset();this.init(this.parent)},reset:function t(){this.dragItem=null;this.targetItem=null;this.rowsList=null;this.colsList=null;this.dragRect=null;this.offset=null;this.startDragOffset=null;this.dragColumn=null;this.targetColumn=null;this.isDrag=null;this.fixedTableColsList=null},isActive:function t(){return this.isDrag},registerObjects:function t(){this.unregisterObjects();this.getColsList().forEach(this.register,this);this.getFixedHeaderColsList().forEach(this.register,this)},unregisterObjects:function t(){this.getColsList().forEach(this.unregister,this);this.getFixedHeaderColsList().forEach(this.unregister,this)},unregister:function t(e){jsDD.unregisterObject(e)},register:function t(e){e.onbxdragstart=BX.proxy(this._onDragStart,this);e.onbxdrag=BX.proxy(this._onDrag,this);e.onbxdragstop=BX.proxy(this._onDragEnd,this);jsDD.registerObject(e)},getColsList:function t(){if(!this.colsList){this.colsList=BX.Grid.Utils.getByTag(this.parent.getRows().getHeadFirstChild().getNode(),"th");this.colsList=this.colsList.filter((function(t){return!this.isStatic(t)}),this)}return this.colsList},getFixedHeaderColsList:function t(){if(!this.fixedTableColsList&&this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTableColsList=BX.Grid.Utils.getByTag(this.parent.getPinHeader().getFixedTable(),"th");this.fixedTableColsList=this.fixedTableColsList.filter((function(t){return!this.isStatic(t)}),this)}return this.fixedTableColsList||[]},getRowsList:function t(){var e=this.parent.getRows().getSourceRows();if(this.parent.getParam("ALLOW_PIN_HEADER")){e=e.concat(BX.Grid.Utils.getByTag(this.parent.getPinHeader().getFixedTable(),"tr"))}return e},isStatic:function t(e){return BX.hasClass(e,this.parent.settings.get("classCellStatic"))&&!BX.hasClass(e,"main-grid-fixed-column")},getDragOffset:function t(){var e=this.parent.getScrollContainer().scrollLeft-this.startScrollOffset;return jsDD.x-this.startDragOffset-this.dragRect.left+e},getColumn:function t(e){var i=[];if(e instanceof HTMLTableCellElement){i=this.rowsList.map((function(t){return t.cells[e.cellIndex]}))}return i},_onDragStart:function t(){if(this.parent.getParam("ALLOW_PIN_HEADER")&&this.parent.getPinHeader().isPinned()){this.colsList=this.getFixedHeaderColsList()}else{this.colsList=this.getColsList()}this.startScrollOffset=this.parent.getScrollContainer().scrollLeft;this.isDrag=true;this.dragItem=jsDD.current_node;this.dragRect=this.dragItem.getBoundingClientRect();this.offset=Math.ceil(this.dragRect.width);this.startDragOffset=jsDD.start_x-this.dragRect.left;this.dragColumn=this.getColumn(this.dragItem);this.dragIndex=BX.Grid.Utils.getIndex(this.colsList,this.dragItem);this.parent.preventSortableClick=true},isDragToRight:function t(e,i){var n=e.getBoundingClientRect();var s=Math.ceil(n.left+n.width/2+BX.scrollLeft(window));var a=this.dragIndex;var r=jsDD.x;return i>a&&r>s},isDragToLeft:function t(e,i){var n=e.getBoundingClientRect();var s=Math.ceil(n.left+n.width/2+BX.scrollLeft(window));var a=this.dragIndex;var r=jsDD.x;return i<a&&r<s},isDragToBack:function t(e,i){var n=e.getBoundingClientRect();var s=Math.ceil(n.left+n.width/2+BX.scrollLeft(window));var a=this.dragIndex;var r=jsDD.x;return i>a&&r<s||i<a&&r>s},isMovedToRight:function t(e){return e.style.transform==="translate3d("+-this.offset+"px, 0px, 0px)"},isMovedToLeft:function t(e){return e.style.transform==="translate3d("+this.offset+"px, 0px, 0px)"},isMoved:function t(e){return e.style.transform!=="translate3d(0px, 0px, 0px)"&&e.style.transform!==""},moveColumn:function t(e,i,n){n=BX.type.isNumber(n)?n:300;BX.Grid.Utils.styleForEach(e,{transition:n+"ms",transform:"translate3d("+i+"px, 0px, 0px)"})},_onDrag:function t(){this.dragOffset=this.getDragOffset();this.targetItem=this.targetItem||this.dragItem;this.targetColumn=this.targetColumn||this.dragColumn;var e=-this.offset;var i=this.offset;var n=0;var s=0;this.moveColumn(this.dragColumn,this.dragOffset,s);[].forEach.call(this.colsList,(function(t,s){if(t&&!t.classList.contains("main-grid-cell-static")){if(this.isDragToRight(t,s)&&!this.isMovedToRight(t)){this.targetColumn=this.getColumn(t);this.moveColumn(this.targetColumn,e)}if(this.isDragToLeft(t,s)&&!this.isMovedToLeft(t)){this.targetColumn=this.getColumn(t);this.moveColumn(this.targetColumn,i)}if(this.isDragToBack(t,s)&&this.isMoved(t)){this.targetColumn=this.getColumn(t);this.moveColumn(this.targetColumn,n)}}}),this)},_onDragEnd:function t(){[].forEach.call(this.dragColumn,(function(t,e){BX.Grid.Utils.collectionSort(t,this.targetColumn[e])}),this);this.rowsList.forEach((function(t){BX.Grid.Utils.styleForEach(t.cells,{transition:"",transform:""})}));this.reinit();var e=this.colsList.map((function(t){return BX.data(t,"name")}));this.parent.getUserOptions().setColumns(e);BX.onCustomEvent(this.parent.getContainer(),"Grid::columnMoved",[this.parent]);setTimeout(function(){this.parent.preventSortableClick=false}.bind(this),10)}}})();(function(){BX.namespace("BX.Grid");var t=window.parent.BX.ajax.UpdatePageData;function e(){window.parent.BX.ajax.UpdatePageData=function(){}}function i(){window.parent.BX.ajax.UpdatePageData=t}BX.Grid.Data=function(t){this.parent=t;this.reset()};BX.Grid.Data.prototype.reset=function(){this.response=null;this.xhr=null;this.headRows=null;this.bodyRows=null;this.footRows=null;this.moreButton=null;this.pagination=null;this.counterDisplayed=null;this.counterSelected=null;this.counterTotal=null;this.limit=null;this.actionPanel=null;this.rowsByParentId={};this.rowById={};this.isValidResponse=null};BX.Grid.Data.prototype.getParent=function(){return this.parent};BX.Grid.Data.prototype.validateResponse=function(){if(!BX.type.isBoolean(this.isValidResponse)){this.isValidResponse=!!this.getResponse()&&!!BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classContainer"),true)}return this.isValidResponse};BX.Grid.Data.prototype.request=function(t,n,s,a,r,o){if(!BX.type.isString(t)){t=""}if(!BX.type.isNotEmptyString(n)){n="GET"}if(!BX.type.isPlainObject(s)){s={}}var l={gridId:this.parent.getId(),url:t,method:n,data:s};this.parent.disableCheckAllCheckboxes();BX.onCustomEvent(window,"Grid::beforeRequest",[this,l]);if(l.hasOwnProperty("cancelRequest")&&l.cancelRequest===true){return}t=l.url;if(!BX.type.isNotEmptyString(t)){t=this.parent.baseUrl}t=BX.Grid.Utils.addUrlParams(t,{sessid:BX.bitrix_sessid(),internal:"true",grid_id:this.parent.getId()});if("apply_filter"in s&&s.apply_filter==="Y"){t=BX.Grid.Utils.addUrlParams(t,{apply_filter:"Y"})}else{t=BX.util.remove_url_param(t,"apply_filter")}if("clear_nav"in s&&s.clear_nav==="Y"){t=BX.Grid.Utils.addUrlParams(t,{clear_nav:"Y"})}else{t=BX.util.remove_url_param(t,"clear_nav")}t=BX.Grid.Utils.addUrlParams(t,{grid_action:a||"showpage"});n=l.method;s=l.data;this.reset();var d=this;setTimeout((function(){var l=BX.Http.Data.convertObjectToFormData(s);e();var c=BX.ajax({url:BX.Grid.Utils.ajaxUrl(t,d.getParent().getAjaxId()),data:l,method:n,dataType:"html",headers:[{name:"X-Ajax-Grid-UID",value:d.getParent().getAjaxId()},{name:"X-Ajax-Grid-Req",value:JSON.stringify({action:a||"showpage"})}],processData:true,scriptsRunFirst:false,start:false,preparePost:false,onsuccess:function t(e){d.response=BX.create("div",{html:e});d.response=d.response.querySelector("#"+d.parent.getContainerId());d.xhr=c;if(d.parent.getParam("HANDLE_RESPONSE_ERRORS")){var n;try{n=JSON.parse(e)}catch(t){n={messages:[]}}if(n.messages.length){d.parent.arParams["MESSAGES"]=n.messages;d.parent.messages.show();d.parent.tableUnfade();if(BX.type.isFunction(o)){BX.delegate(o,d)(c)}return}}if(BX.type.isFunction(r)){d.parent.enableCheckAllCheckboxes();BX.delegate(r,d)(e,c)}i()},onerror:function t(e){d.error=o;d.xhr=c;if(BX.type.isFunction(o)){d.parent.enableCheckAllCheckboxes();BX.delegate(o,d)(c,e)}}});c.send(l)}),0)};BX.Grid.Data.prototype.getResponse=function(){return this.response};BX.Grid.Data.prototype.getContainer=function(){var t=this.getParent().settings.get("classContainer");if(BX.Dom.hasClass(this.getResponse(),t)){return this.getResponse()}return BX.Grid.Utils.getByClass(this.getResponse(),t,true)};BX.Grid.Data.prototype.getHeadRows=function(){if(!this.headRows){this.headRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classHeadRow"))}return this.headRows};BX.Grid.Data.prototype.getBodyRows=function(){if(!this.bodyRows){this.bodyRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classBodyRow"))}return this.bodyRows};BX.Grid.Data.prototype.getRowsByParentId=function(t){if(!(t in this.rowsByParentId)){this.rowsByParentId[t]=BX.Grid.Utils.getBySelector(this.getResponse(),"."+this.getParent().settings.get("classBodyRow")+'[data-parent-id="'+t+'"]')}return this.rowsByParentId[t]};BX.Grid.Data.prototype.getRowById=function(t){if(!(t in this.rowById)){this.rowById[t]=BX.Grid.Utils.getBySelector(this.getResponse(),"."+this.getParent().settings.get("classBodyRow")+'[data-id="'+t+'"]',true)}return this.rowById[t]};BX.Grid.Data.prototype.getFootRows=function(){if(!this.footRows){this.footRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classFootRow"))}return this.footRows};BX.Grid.Data.prototype.getMoreButton=function(){if(!this.moreButton){this.moreButton=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classMoreButton"),true)}return this.moreButton};BX.Grid.Data.prototype.getPagination=function(){if(!this.pagination){this.pagination=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classPagination"),true);if(BX.type.isDomNode(this.pagination)){this.pagination=BX.firstChild(this.pagination)}}return this.pagination};BX.Grid.Data.prototype.getCounterDisplayed=function(){if(!this.counterDisplayed){this.counterDisplayed=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classCounterDisplayed"),true)}return this.counterDisplayed};BX.Grid.Data.prototype.getCounterSelected=function(){if(!this.counterSelected){this.counterSelected=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classCounterSelected"),true)}return this.counterSelected};BX.Grid.Data.prototype.getCounterTotal=function(){if(!BX.type.isDomNode(this.counterTotal)){var t="."+this.getParent().settings.get("classCounterTotal")+" ."+this.getParent().settings.get("classPanelCellContent");this.counterTotal=BX.Grid.Utils.getBySelector(this.getResponse(),t,true)}return this.counterTotal};BX.Grid.Data.prototype.getLimit=function(){if(!this.limit){this.limit=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classPageSize"),true)}return this.limit};BX.Grid.Data.prototype.getPageSize=function(){return this.getLimit()};BX.Grid.Data.prototype.getActionPanel=function(){if(!this.actionPanel){this.actionPanel=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classActionPanel"),true)}return this.actionPanel}})();(function(){BX.namespace("BX.Main");BX.Main.dropdown=function(t){this.id=null;this.dropdown=null;this.items=null;this.value=null;this.menuId=null;this.menu=null;this.menuItems=null;this.multiple=null;this.emptyText=null;this.dataItems="items";this.dataValue="value";this.dataPseudo="pseudo";this.dropdownItemClass="main-dropdown-item";this.activeClass="main-dropdown-active";this.selectedClass="main-dropdown-item-selected";this.notSelectedClass="main-dropdown-item-not-selected";this.lockedClass="main-dropdown-item-locked";this.menuItemClass="menu-popup-item";this.init(t)};BX.Main.dropdown.prototype={init:function t(e){this.id=e.id;this.dropdown=e;this.items=this.getItems();this.value=this.getValue();this.menuId=this.getMenuId();this.multiple=this.getMultiple();this.emptyText=this.getEmptyText();this.menu=this.createMenu();this.menu.popupWindow.show();this.adjustPosition();BX.bind(this.dropdown,"click",BX.delegate(this.showMenu,this))},getMenuId:function t(){return this.id+"_menu"},getItems:function getItems(){var result;try{var str=BX.data(this.dropdown,this.dataItems);result=eval(str)}catch(t){result=[]}return result},getValue:function t(){return BX.data(this.dropdown,this.dataValue)},getValueItem:function t(){var e=this.getValue();return this.getItems().find((function(t){return t.VALUE===e}))},getValueAsArray:function t(){var e=this.getValue();if(e===undefined){e=""}return e.toString().split(",").filter((function(t){return t!==""}))},getValueItems:function t(){var e=this.getValueAsArray();return this.getItems().filter((function(t){return e.includes(t.VALUE)}))},toggleValue:function t(e){if(this.multiple){if(e||e===0||e==="0"){var i=this.getValueAsArray();var n=i.indexOf(e);if(n<0){i.push(e)}else{i.splice(n,1)}this.dropdown.dataset[this.dataValue]=i.join(",")}else{this.dropdown.dataset[this.dataValue]=null}}else{this.dropdown.dataset[this.dataValue]=e}},getValueText:function t(){if(this.multiple){return this.getValueItems().map((function(t){return t.NAME})).filter((function(t){return!!t})).join(", ")||this.emptyText}var e=this.getValueItem();return e?e.NAME:this.emptyText},getMultiple:function t(){return this.dropdown.dataset.multiple==="Y"},getEmptyText:function t(){return this.dropdown.dataset.emptyText||null},prepareMenuItems:function t(){var e=this;var i,n;var s=this.multiple?this.getValueAsArray():this.getValue();function a(t){var r=e.dropdown.dataset["htmlEntity"]==="true";return t.map((function(t){i={};i["data-"+e.dataValue]=t.VALUE;i["data-"+e.dataPseudo]="PSEUDO"in t&&t.PSEUDO?"true":"false";n=BX.create("div",{children:[BX.create("span",{props:{className:e.dropdownItemClass},attrs:i,html:r?t.NAME:null,text:r?null:t.NAME})]});var o=e.multiple?s.includes(t.VALUE):s===t.VALUE;return{html:n.innerHTML,className:o?e.selectedClass:e.notSelectedClass,delimiter:t.DELIMITER,items:"ITEMS"in t?a(t.ITEMS):null}}))}var r=a(this.getItems());BX.onCustomEvent(window,"Dropdown::onPrepareItems",[this.id,this.menuId,r]);return r},createMenu:function t(){var e=this;return BX.PopupMenu.create(this.getMenuId(),this.dropdown,this.prepareMenuItems(),{autoHide:true,offsetTop:-8,offsetLeft:+(this.dropdown.dataset.menuOffsetLeft||40),maxHeight:+(this.dropdown.dataset.menuMaxHeight||170),angle:{position:"bottom",offset:0},events:{onPopupClose:BX.delegate(this._onCloseMenu,this),onPopupShow:function t(){e._onShowMenu()}}})},showMenu:function t(){this.menu=BX.PopupMenu.getMenuById(this.menuId);if(!this.menu){this.menu=this.createMenu();this.menu.popupWindow.show()}this.adjustPosition()},adjustPosition:function t(){if(this.dropdown.dataset.popupPosition==="fixed"){var e=this.menu.popupWindow.popupContainer;e.style.setProperty("top","auto");e.style.setProperty("bottom","45px");e.style.setProperty("left","0px");this.dropdown.appendChild(e)}},getSubItem:function t(e){return BX.Grid.Utils.getByClass(e,this.dropdownItemClass,true)},refresh:function t(e){var i=this.getSubItem(e);var n=BX.data(i,this.dataValue);if(BX.Type.isUndefined(n)){n=""}this.toggleValue(n);if(this.dropdown.dataset["htmlEntity"]==="true"){BX.firstChild(this.dropdown).innerHTML=this.getValueText()}else{BX.firstChild(this.dropdown).innerText=this.getValueText()}},selectItem:function t(e){var i=this;(this.menu.menuItems||[]).forEach((function(t){if(i.multiple){if(e===t.layout.item){if(BX.hasClass(e,i.selectedClass)){BX.addClass(t.layout.item,i.notSelectedClass);BX.removeClass(t.layout.item,i.selectedClass)}else{BX.removeClass(t.layout.item,i.notSelectedClass);BX.addClass(t.layout.item,i.selectedClass)}}return}BX.removeClass(t.layout.item,i.selectedClass);if(e!==t.layout.item){BX.addClass(t.layout.item,i.notSelectedClass)}else{BX.removeClass(t.layout.item,i.notSelectedClass);BX.addClass(t.layout.item,i.selectedClass)}}))},lockedItem:function t(e){BX.addClass(e,this.lockedClass)},getDataItemIndexByValue:function t(e,i){if(BX.type.isArray(e)){e.map((function(t,e){if(t.VALUE===i){return false}}))}return false},getDataItemByValue:function t(e){var i=this.getItems().filter((function(t){return t.VALUE===e}));return i.length>0?i[0]:null},_onShowMenu:function t(){var e=this;BX.addClass(this.dropdown,this.activeClass);(this.menu.menuItems||[]).forEach((function(t){BX.bind(t.layout.item,"click",BX.delegate(e._onItemClick,e))}))},_onCloseMenu:function t(){BX.removeClass(this.dropdown,this.activeClass);BX.PopupMenu.destroy(this.menuId)},_onItemClick:function t(e){var i=this.getMenuItem(e.target);var n,s;var a=this.getSubItem(i);var r=BX.data(a,"pseudo");if(!(r==="true")){this.refresh(i);this.selectItem(i);if(!this.multiple){this.menu.popupWindow.close()}n=this.getValue();s=this.getDataItemByValue(n)}else{n=BX.data(a,"value");s=this.getDataItemByValue(n)}e.stopPropagation();BX.onCustomEvent(window,"Dropdown::change",[this.dropdown.id,e,i,s,n])},getMenuItem:function t(e){var i=e;if(!BX.hasClass(i,this.menuItemClass)){i=BX.findParent(i,{class:this.menuItemClass})}return i}}})();(function(){BX.namespace("BX.Main");BX.Main.dropdownManager={dropdownClass:"main-dropdown",data:{},init:function init(){var self=this;var result;var onLoadItems;var items;BX.bind(document,"click",BX.delegate((function(t){if(BX.hasClass(t.target,this.dropdownClass)){t.preventDefault();result=this.getById(t.target.id);if(result&&result.dropdown===t.target){self.push(t.target.id,this.getById(t.target.id))}else{self.push(t.target.id,new BX.Main.dropdown(t.target))}}}),this));onLoadItems=BX.Grid.Utils.getByClass(document.body,this.dropdownClass);if(BX.type.isArray(onLoadItems)){onLoadItems.forEach((function(current){result=self.getById(current.id);try{items=eval(BX.data(current,"items"))}catch(t){}BX.onCustomEvent(window,"Dropdown::load",[current.id,{},null,BX.type.isArray(items)&&items.length?items[0]:[],BX.data(current,"value")])}))}},push:function t(e,i){this.data[e]=i},getById:function t(e){return e in this.data?this.data[e]:null}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Element=function(t,e){this.node=null;this.href=null;this.parent=null;this.init(t,e)};BX.Grid.Element.prototype={init:function t(e,i){this.node=e;this.parent=i;this.resetOnclickAttr()},getParent:function t(){return this.parent},load:function t(){BX.addClass(this.getNode(),this.getParent().settings.get("classLoad"))},unload:function t(){BX.removeClass(this.getNode(),this.getParent().settings.get("classLoad"))},isLoad:function t(){return BX.hasClass(this.getNode(),this.getParent().settings.get("classLoad"))},resetOnclickAttr:function t(){if(BX.type.isDomNode(this.getNode())){this.getNode().onclick=null}},getObserver:function t(){return BX.Grid.observer},getNode:function t(){return this.node},getLink:function t(){var e;try{e=this.getNode().href}catch(t){e=null}return e}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Fader=function(t){this.parent=null;this.table=null;this.container=null;this.init(t)};BX.Grid.Fader.prototype={init:function t(e){this.parent=e;this.table=this.parent.getTable();this.container=this.table.parentNode;this.scrollStartEventName=this.parent.isTouch()?"touchstart":"mouseenter";this.scrollEndEventName=this.parent.isTouch()?"touchend":"mouseleave";if(this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTable=this.parent.getPinHeader().getFixedTable()}this.debounceScrollHandler=BX.debounce(this._onWindowScroll,400,this);BX.bind(window,"resize",BX.proxy(this.toggle,this));document.addEventListener("scroll",this.debounceScrollHandler,BX.Grid.Utils.listenerParams({passive:true}));this.container.addEventListener("scroll",BX.proxy(this.toggle,this),BX.Grid.Utils.listenerParams({passive:true}));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this.toggle,this));BX.addCustomEvent(window,"Grid::resize",BX.proxy(this.toggle,this));BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this._onHeaderUpdated,this));BX.addCustomEvent(window,"Grid::columnResize",BX.proxy(this.toggle,this));BX.bind(this.getEarLeft(),this.scrollStartEventName,BX.proxy(this._onMouseoverLeft,this));BX.bind(this.getEarRight(),this.scrollStartEventName,BX.proxy(this._onMouseoverRight,this));BX.bind(this.getEarLeft(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));BX.bind(this.getEarRight(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));this.toggle();this.adjustEarOffset(true)},destroy:function t(){BX.unbind(window,"resize",BX.proxy(this.toggle,this));document.removeEventListener("scroll",this.debounceScrollHandler,BX.Grid.Utils.listenerParams({passive:true}));this.container.removeEventListener("scroll",BX.proxy(this.toggle,this),BX.Grid.Utils.listenerParams({passive:true}));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this.toggle,this));BX.removeCustomEvent(window,"Grid::headerUpdated",BX.proxy(this._onHeaderUpdated,this));BX.removeCustomEvent(window,"Grid::columnResize",BX.proxy(this.toggle,this));BX.unbind(this.getEarLeft(),this.scrollStartEventName,BX.proxy(this._onMouseoverLeft,this));BX.unbind(this.getEarRight(),this.scrollStartEventName,BX.proxy(this._onMouseoverRight,this));BX.unbind(this.getEarLeft(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));BX.unbind(this.getEarRight(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));this.hideLeftEar();this.hideRightEar();this.stopScroll()},_onHeaderUpdated:function t(){if(this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTable=this.parent.getPinHeader().getFixedTable()}},_onMouseoverLeft:function t(e){this.parent.isTouch()&&e.preventDefault();this.startScrollByDirection("left")},_onMouseoverRight:function t(e){this.parent.isTouch()&&e.preventDefault();this.startScrollByDirection("right")},stopScroll:function t(){clearTimeout(this.scrollTimer);clearInterval(this.scrollInterval)},startScrollByDirection:function t(e){var i=this.container;var n=i.scrollLeft;var s=this;var a=8;var r=1e3/60/2;this.scrollTimer=setTimeout((function(){s.scrollInterval=setInterval((function(){i.scrollLeft=e=="right"?n+=a:n-=a}),r)}),100)},getEarLeft:function t(){if(!this.earLeft){this.earLeft=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classEarLeft"),true)}return this.earLeft},getEarRight:function t(){if(!this.earRight){this.earRight=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classEarRight"),true)}return this.earRight},getShadowLeft:function t(){return this.parent.getContainer().querySelector(".main-grid-fade-shadow-left")},getShadowRight:function t(){return this.parent.getContainer().querySelector(".main-grid-fade-shadow-right")},adjustEarOffset:function t(e){if(e){this.windowHeight=BX.height(window);this.tbodyPos=BX.pos(this.table.tBodies[0]);this.headerPos=BX.pos(this.table.tHead)}var i=window.scrollY;if(this.parent.isIE()){i=document.documentElement.scrollTop}var n=i+this.windowHeight-this.tbodyPos.top;var s=i-this.tbodyPos.top;if(n>this.tbodyPos.bottom-this.tbodyPos.top){n=this.tbodyPos.bottom-this.tbodyPos.top}if(s<this.headerPos.height){s=this.headerPos.height}else{n-=s;n+=this.headerPos.height}BX.Grid.Utils.requestAnimationFrame(BX.proxy((function(){if(s!==this.lastPosTop){var t="translate3d(0px, "+s+"px, 0)";this.getEarLeft().style.transform=t;this.getEarRight().style.transform=t}if(n!==this.lastBottomPos){this.getEarLeft().style.height=n+"px";this.getEarRight().style.height=n+"px"}this.lastPosTop=s;this.lastBottomPos=n}),this))},_onWindowScroll:function t(){this.adjustEarOffset()},hasScroll:function t(){return this.table.offsetWidth>this.container.clientWidth},hasScrollLeft:function t(){return this.container.scrollLeft>0},hasScrollRight:function t(){return this.table.offsetWidth>this.container.scrollLeft+this.container.clientWidth},showLeftEar:function t(){BX.addClass(this.container.parentNode,this.parent.settings.get("classFadeContainerLeft"));BX.addClass(this.getEarLeft(),this.parent.settings.get("classShow"))},hideLeftEar:function t(){BX.removeClass(this.container.parentNode,this.parent.settings.get("classFadeContainerLeft"));BX.removeClass(this.getEarLeft(),this.parent.settings.get("classShow"))},showRightEar:function t(){BX.addClass(this.container.parentNode,this.parent.settings.get("classFadeContainerRight"));BX.addClass(this.getEarRight(),this.parent.settings.get("classShow"))},hideRightEar:function t(){BX.removeClass(this.container.parentNode,this.parent.settings.get("classFadeContainerRight"));BX.removeClass(this.getEarRight(),this.parent.settings.get("classShow"))},adjustFixedTablePosition:function t(){var e=this.container.scrollLeft;BX.Grid.Utils.requestAnimationFrame(BX.delegate((function(){this.fixedTable.style.marginLeft=-e+"px"}),this))},toggle:function t(){this.adjustEarOffset(true);this.fixedTable&&this.adjustFixedTablePosition();if(this.hasScroll()){this.hasScrollLeft()?this.showLeftEar():this.hideLeftEar();this.hasScrollRight()?this.showRightEar():this.hideRightEar()}else{this.hideLeftEar();this.hideRightEar()}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Updater=function(t){this.parent=t};BX.Grid.Updater.prototype.getParent=function(){return this.parent};BX.Grid.Updater.prototype.updateHeadRows=function(t){var e;if(BX.type.isArray(t)&&t.length){e=this.getParent().getHeaders();e.forEach((function(e){e=BX.cleanNode(e);t.forEach((function(t){if(BX.type.isDomNode(t)){e.appendChild(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.appendHeadRows=function(t){var e;if(BX.type.isArray(t)&&t.length){e=this.getParent().getHeaders();e.forEach((function(e){t.forEach((function(t){if(BX.type.isDomNode(t)){e.appendChild(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.prependHeadRows=function(t){var e;if(BX.type.isArray(t)&&t.length){e=this.getParent().getHeaders();e.forEach((function(e){e=BX.cleanNode(e);t.forEach((function(t){if(BX.type.isDomNode(t)){e.prepend(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.updateBodyRowById=function(t,e){if((BX.type.isNumber(t)||BX.type.isNotEmptyString(t))&&BX.type.isDomNode(e)){var i=this.getParent().getRows().getById(t);if(i){var n=i.getNode();BX.insertAfter(e,n);BX.remove(n)}}};BX.Grid.Updater.prototype.updateBodyRows=function(t){if(BX.type.isArray(t)){var e=this.getParent().getBody();e.innerHTML="";t.forEach((function(t){!!t&&e.appendChild(t)}))}};BX.Grid.Updater.prototype.appendBodyRows=function(t){var e;if(BX.type.isArray(t)){e=this.getParent().getBody();t.forEach((function(t){if(BX.type.isDomNode(t)){e.appendChild(t)}}))}};BX.Grid.Updater.prototype.prependBodyRows=function(t){var e;if(BX.type.isArray(t)){e=this.getParent().getBody();t.forEach((function(t){if(BX.type.isDomNode(t)){BX.prepend(e,t)}}))}};BX.Grid.Updater.prototype.updateFootRows=function(t){var e;if(BX.type.isArray(t)){e=BX.cleanNode(this.getParent().getFoot());t.forEach((function(t){if(BX.type.isDomNode(t)){e.appendChild(t)}}))}};BX.Grid.Updater.prototype.updateCounterTotal=function(t){var e;if(BX.type.isDomNode(t)){e=BX.cleanNode(this.getParent().getCounterTotal());e.appendChild(t)}};BX.Grid.Updater.prototype.updatePagination=function(t){var e=this.getParent().getPagination().getContainer();if(!!e){e.innerHTML="";if(BX.type.isDomNode(t)){e.appendChild(t)}}};BX.Grid.Updater.prototype.updateMoreButton=function(t){if(BX.type.isDomNode(t)){var e=BX.Grid.Utils.closestParent(this.getParent().getMoreButton().getNode());e.innerHTML="";e.appendChild(t)}};BX.Grid.Updater.prototype.updateGroupActions=function(t){var e=this.parent.getActionsPanel();if(!!e&&BX.type.isDomNode(t)){var i=e.getPanel();if(BX.type.isDomNode(i)){i.innerHTML="";var n=BX.firstChild(t);if(BX.type.isDomNode(n)){i.appendChild(n)}}}};BX.Grid.Updater.prototype.updateContainer=function(t){if(BX.Type.isDomNode(t)){this.getParent().getContainer().className=t.className}}})();(function(){BX.Reflection.namespace("BX.Grid");BX.Grid.ImageField=function(t,e){this.parent=t;this.options=e;this.cache=new BX.Cache.MemoryCache};BX.Grid.ImageField.prototype={getPreview:function t(){return this.cache.remember("preview",function(){return BX.create("img",{props:{className:"main-grid-image-editor-preview"},attrs:{src:this.options.VALUE}})}.bind(this))},getFileInput:function t(){return this.cache.remember("fileInput",function(){return BX.create("input",{props:{className:"main-grid-image-editor-file-input"},attrs:{type:"file",accept:"image/*",name:this.options.NAME},events:{change:function(t){var e=new FileReader;e.onload=function(t){this.getPreview().src=t.currentTarget.result}.bind(this);e.readAsDataURL(t.target.files[0]);BX.Dom.remove(this.getFakeField());BX.Dom.append(this.getFileInput(),this.getLayout());BX.Dom.removeClass(this.getRemoveButton(),"ui-btn-disabled");BX.Dom.style(this.getPreview(),null)}.bind(this)}})}.bind(this))},getUploadButton:function t(){return this.cache.remember("uploadButton",function(){return BX.create("button",{props:{className:"ui-btn ui-btn-xs"},text:this.parent.getParam("MAIN_UI_GRID_IMAGE_EDITOR_BUTTON_EDIT"),events:{click:function(t){t.preventDefault();this.getFileInput().click()}.bind(this)}})}.bind(this))},getRemoveButton:function t(){return this.cache.remember("removeButton",function(){return BX.create("button",{props:{className:"ui-btn ui-btn-xs ui-btn-danger"},events:{click:function(t){t.preventDefault();BX.Dom.append(this.getFakeField(),this.getLayout());BX.Dom.remove(this.getFileInput());BX.Dom.addClass(this.getRemoveButton(),"ui-btn-disabled");BX.Dom.style(this.getPreview(),{opacity:.4})}.bind(this)},text:this.parent.getParam("MAIN_UI_GRID_IMAGE_EDITOR_BUTTON_REMOVE")})}.bind(this))},getFakeField:function t(){return this.cache.remember("deleted",function(){return BX.create("input",{props:{className:"main-grid-image-editor-fake-file-input"},attrs:{type:"hidden",name:this.options.NAME,value:"null"}})}.bind(this))},getLayout:function t(){return this.cache.remember("layout",function(){return BX.create("div",{props:{className:"main-grid-image-editor main-grid-editor"},attrs:{name:this.options.NAME},children:[BX.create("div",{props:{className:"main-grid-image-editor-left"},children:[this.getPreview()]}),BX.create("div",{props:{className:"main-grid-image-editor-right"},children:[this.getUploadButton(),this.getRemoveButton()]}),this.getFileInput()]})}.bind(this))}}})();var _templateObject,_templateObject2;(function(){BX.namespace("BX.Grid");BX.Grid.InlineEditor=function(t,e){this.parent=null;this.types=null;this.isDropdownChangeEventSubscribed=false;this.init(t,e)};BX.Grid.InlineEditor.prototype={init:function init(parent,types){this.parent=parent;try{this.types=eval(types)}catch(t){this.types=null}},createContainer:function t(){return BX.create("div",{props:{className:this.parent.settings.get("classEditorContainer")}})},createTextarea:function t(e,i){var n=BX.create("textarea",{props:{className:[this.parent.settings.get("classEditor"),this.parent.settings.get("classEditorTextarea")].join(" ")},attrs:{name:e.NAME,style:"height:"+i+"px"},html:e.VALUE});return n},createInput:function t(e){var i=this.parent.settings.get("classEditorText");var n={value:e.VALUE!==undefined&&e.VALUE!==null?BX.util.htmlspecialcharsback(e.VALUE):"",name:e.NAME!==undefined&&e.NAME!==null?e.NAME:""};if(e.TYPE===this.types.CHECKBOX){i=this.parent.settings.get("classEditorCheckbox");n.type="checkbox";n.checked=n.value=="Y"}if(e.TYPE===this.types.DATE){i=[i,this.parent.settings.get("classEditorDate")].join(" ")}if(e.TYPE===this.types.NUMBER){i=[i,this.parent.settings.get("classEditorNumber")].join(" ");n.type="number"}if(e.TYPE===this.types.RANGE){i=[i,this.parent.settings.get("classEditorRange")].join(" ");n.type="range";if(BX.type.isPlainObject(e.DATA)){n.min=e.DATA.MIN||"0";n.max=e.DATA.MAX||99999;n.step=e.DATA.STEP||""}}if(BX.type.isNotEmptyString(e.PLACEHOLDER)){n.placeholder=BX.util.htmlspecialchars(e.PLACEHOLDER)}if(e.DISABLED){n.disabled=true}i=[this.parent.settings.get("classEditor"),i].join(" ");return BX.create("input",{props:{className:i,id:e.NAME+"_control"},attrs:n})},createCustom:function t(e){var i=this.parent.settings.get("classEditorCustom");i=[this.parent.settings.get("classEditor"),i].join(" ");return BX.create("div",{props:{className:i},attrs:{"data-name":e.NAME},html:e.VALUE||""})},createMoney:function t(e){var i=e.VALUE;var n=[];var s=i.PRICE||{};s.PLACEHOLDER=e.PLACEHOLDER||"";n.push(this.createMoneyPrice(s));if(BX.type.isArray(e.CURRENCY_LIST)&&e.CURRENCY_LIST.length>0){var a=i.CURRENCY||{};a.DATA={ITEMS:e.CURRENCY_LIST};a.HTML_ENTITY=e.HTML_ENTITY||false;n.push(this.createMoneyCurrency(a))}if(BX.type.isNotEmptyObject(i.HIDDEN)){for(var r in i.HIDDEN){if(i.HIDDEN.hasOwnProperty(r)&&BX.type.isNotEmptyString(r)){var o=this.createInput({NAME:r,VALUE:i["HIDDEN"][r],TYPE:this.types.TEXT});o.type="hidden";n.push(o)}}}var l=this.parent.settings.get("classEditorMoney");l=[this.parent.settings.get("classEditor"),l].join(" ");var d=i.ATTRIBUTES||{};d["data-name"]=e.NAME;return BX.create("div",{props:{className:l},attrs:d,children:n})},createMoneyPrice:function t(e){e.TYPE=this.types.NUMBER;var i=this.createInput(e);i.classList.add("main-grid-editor-money-price");main_core.Event.bind(i,"change",(function(t){var e=t.target.parentNode;var i=e.querySelector(".main-grid-editor-money-currency");var n={field:e,values:{price:t.target.value||"",currency:i.dataset.value||""}};main_core_events.EventEmitter.emit("Grid.MoneyField::change",n)}));return i},createMoneyCurrency:function t(e){var i=this.createDropdown(e);i.dataset.menuOffsetLeft=15;i.dataset.menuMaxHeight=200;i.classList.add("main-grid-editor-money-currency");if(e.DISABLED===true){i.classList.remove("main-dropdown");i.dataset.disabled=true}if(!this.isDropdownChangeEventSubscribed){this.isDropdownChangeEventSubscribed=true;main_core_events.EventEmitter.subscribe("Dropdown::change",(function(t){var e=t.getData(),i=babelHelpers.slicedToArray(e,1),n=i[0];if(!BX.type.isNotEmptyString(n)){return}var s=BX.Main.dropdownManager.getById(n);if(s.dropdown&&s.dropdown.classList.contains("main-grid-editor-money-currency")){var a=s.dropdown.parentNode;var r=a.querySelector(".main-grid-editor-money-price");var o={field:a,values:{price:r.value||"",currency:s.dropdown.dataset.value||""}};main_core_events.EventEmitter.emit("Grid.MoneyField::change",o)}}))}return i},createOutput:function t(e){return BX.create("output",{props:{className:this.parent.settings.get("classEditorOutput")||""},attrs:{for:e.NAME+"_control"},text:e.VALUE||""})},getDropdownValueItemByValue:function t(e,i){var n=e.filter((function(t){return t.VALUE===i}));return n.length>0?n[0]:e[0]},createDropdown:function t(e){var i=this.getDropdownValueItemByValue(e.DATA.ITEMS,e.VALUE);var n="HTML_ENTITY"in e&&e.HTML_ENTITY===true;return BX.create("div",{props:{className:[this.parent.settings.get("classEditor"),"main-dropdown main-grid-editor-dropdown"].join(" "),id:e.NAME+"_control"},attrs:{name:e.NAME,tabindex:"0","data-items":JSON.stringify(e.DATA.ITEMS),"data-value":i.VALUE,"data-html-entity":e.HTML_ENTITY},children:[BX.create("span",{props:{className:"main-dropdown-inner"},html:n?i.NAME:null,text:n?null:i.NAME})]})},createMultiselect:function t(e){var i=this;var n=[];var s=function(){if(BX.Type.isArrayFilled(e.VALUE)){return e.VALUE.map((function(t){var s;var a=i.getDropdownValueItemByValue(e.DATA.ITEMS,t);n.push(a);var r=(s=a.HTML)!==null&&s!==void 0?s:BX.util.htmlspecialchars(a.NAME);var o=BX.Tag.render(_templateObject||(_templateObject=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<span class="main-ui-square">\n\t\t\t\t\t\t\t\t<span class="main-ui-square-item">','</span>\n\t\t\t\t\t\t\t\t<span class="main-ui-item-icon main-ui-square-delete"></span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t'])),r);BX.Dom.attr(o,"data-item",a);return o}))}return[]}();var a=BX.Tag.render(_templateObject2||(_templateObject2=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="main-grid-editor main-ui-control main-ui-multi-select"\n\t\t\t\t\tname="','"\n\t\t\t\t\tid="','"\n\t\t\t\t>\n\t\t\t\t\t<span class="main-ui-square-container">','</span>\n\t\t\t\t\t<span class="main-ui-hide main-ui-control-value-delete">\n\t\t\t\t\t\t<span class="main-ui-control-value-delete-item"></span>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class="main-ui-square-search">\n\t\t\t\t\t\t<input type="text" class="main-ui-square-search-item">\n\t\t\t\t\t</span>\t\n\t\t\t\t</div>\n\t\t\t'])),BX.Text.encode(e.NAME),"".concat(BX.Text.encode(e.NAME),"_control"),s);BX.Dom.attr(a,{"data-params":{isMulti:true},"data-items":e.DATA.ITEMS,"data-value":n});return a},validateEditObject:function t(e){return BX.type.isPlainObject(e)&&"TYPE"in e&&"NAME"in e&&"VALUE"in e&&(!("items"in e)||BX.type.isArray(e.items)&&e.items.length)},initCalendar:function t(e){BX.calendar({node:e.target,field:e.target})},bindOnRangeChange:function t(e,i){function n(t,e){BX.html(e,t.value);var i=parseFloat(t.value);var n=parseFloat(t.getAttribute("max"));var s=parseFloat(t.getAttribute("min"));var a=16;var r=n-s;var o=(i-s)/r*100;var l=Math.round(a*o/100)-a/2;e.style.left=o+"%";e.style.marginLeft=-l+"px"}setTimeout((function(){n(e,i)}),0);BX.bind(e,"input",(function(){n(e,i)}))},createImageEditor:function t(e){return new BX.Grid.ImageField(this.parent,e).getLayout()},getEditor:function t(e,i){var n,s;var a=this.createContainer();if(this.validateEditObject(e)){e.VALUE=e.VALUE===null?"":e.VALUE;switch(e.TYPE){case this.types.TEXT:{n=this.createInput(e);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.DATE:{n=this.createInput(e);BX.bind(n,"click",this.initCalendar);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.NUMBER:{n=this.createInput(e);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.RANGE:{n=this.createInput(e);s=this.createOutput(e);this.bindOnRangeChange(n,s);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.CHECKBOX:{n=this.createInput(e);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.TEXTAREA:{n=this.createTextarea(e,i);BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.DROPDOWN:{n=this.createDropdown(e);break}case this.types.MULTISELECT:{n=this.createMultiselect(e);break}case this.types.IMAGE:{n=this.createImageEditor(e);break}case this.types.MONEY:{n=this.createMoney(e);BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.CUSTOM:{n=this.createCustom(e);requestAnimationFrame((function(){var t=e.HTML||e.VALUE||null;if(t){var i=BX.processHTML(t);i.SCRIPT.forEach((function(t){if(t.isInternal&&t.JS){BX.evalGlobal(t.JS)}}))}}));BX.bind(n,"click",(function(t){t.stopPropagation()}));BX.bind(n,"keydown",BX.delegate(this._onControlKeydown,this));break}default:{break}}}if(BX.type.isDomNode(s)){a.appendChild(s)}if(BX.type.isDomNode(n)){a.appendChild(n)}return a},_onControlKeydown:function t(e){if(e.code==="Enter"){e.preventDefault();var i=BX.Grid.Utils.getBySelector(this.parent.getContainer(),"#grid_save_button > button",true);if(i){BX.fireEvent(i,"click")}}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Loader=function(t){this.parent=null;this.container=null;this.windowHeight=null;this.tbodyPos=null;this.headerPos=null;this.lastPosTop=null;this.lastBottomPos=null;this.table=null;this.loader=null;this.adjustLoaderOffset=this.adjustLoaderOffset.bind(this);this.init(t)};BX.Grid.Loader.prototype={init:function t(e){this.parent=e;this.table=this.parent.getTable();this.loader=new BX.Loader({target:this.getContainer()})},adjustLoaderOffset:function t(){this.windowHeight=BX.height(window);this.tbodyPos=BX.pos(this.table.tBodies[0]);this.headerPos=BX.pos(this.table.tHead);var e=window.scrollY;if(this.parent.isIE()){e=document.documentElement.scrollTop}var i=e+this.windowHeight-this.tbodyPos.top;var n=e-this.tbodyPos.top;if(i>this.tbodyPos.bottom-this.tbodyPos.top){i=this.tbodyPos.bottom-this.tbodyPos.top}if(n<this.headerPos.height){n=this.headerPos.height}else{i-=n;i+=this.headerPos.height}requestAnimationFrame(function(){if(n!==this.lastPosTop){this.getContainer().style.transform="translate3d(0px, "+n+"px, 0)"}if(i!==this.lastBottomPos){this.getContainer().style.height=i+"px"}this.lastPosTop=n;this.lastBottomPos=i}.bind(this))},getContainer:function t(){if(!this.container){this.container=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classLoader"),true)}return this.container},show:function t(){if(!this.loader.isShown()){this.adjustLoaderOffset();this.getContainer().style.display="block";this.getContainer().style.opacity="1";this.getContainer().style.visibility="visible";var e=this.parent.getRows().getCountDisplayed();if(e>0&&e<=2){this.loader.setOptions({size:60});this.loader.show()}else{this.loader.setOptions({size:110});this.loader.show()}}},hide:function t(){if(this.loader.isShown()){this.adjustLoaderOffset();this.loader.hide().then(function(){this.getContainer().style.display="none"}.bind(this))}}}})();(function(){BX.namespace("BX.Main");if(BX.Main.gridManager){return}BX.Main.gridManager={data:[],push:function t(e,i){if(BX.type.isNotEmptyString(e)&&i){var n={id:e,instance:i,old:null};if(this.getById(e)===null){this.data.push(n)}else{this.data[0]=n}}},getById:function t(e){var i=this.data.filter((function(t){return t.id===e||t.id.replace("main_grid_","")===e}));return i.length===1?i[0]:null},getInstanceById:function t(e){var i=this.getById(e);return BX.type.isPlainObject(i)?i["instance"]:null},reload:function t(e,i){var n=this.getInstanceById(e);if(n){n.reload(i)}},getDataIndex:function t(e){var i=null;this.data.forEach((function(t,n){if(t.id===e){i=n}}));return i},destroy:function t(e){if(BX.type.isNotEmptyString(e)){var i=this.getInstanceById(e);if(i instanceof BX.Main.grid){i.destroy();var n=this.getDataIndex(e);if(n!==null){delete this.data[n]}}}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Message=function(t,e){this.parent=null;this.types=null;this.messages=null;this.popup=null;this.init(t,e)};BX.Grid.Message.prototype={init:function t(e,i){this.parent=e;this.types=i;this.show();BX.addCustomEvent("BX.Main.grid:paramsUpdated",BX.proxy(this.onUpdated,this))},onUpdated:function t(){this.show()},getData:function t(){return this.parent.arParams.MESSAGES},isNeedShow:function t(){return this.getData().length>0},show:function t(){if(this.isNeedShow()){this.getPopup().setContent(this.getContent());this.getPopup().show()}},getContent:function t(){var e=this.getData();var i=null;if(BX.type.isArray(e)&&e.length){var n={block:"main-grid-messages",content:[]};e.forEach((function(t){var e={block:"main-grid-message",mix:"main-grid-message-"+t.TYPE.toLowerCase(),content:[]};if(BX.type.isNotEmptyString(t.TITLE)){e.content.push({block:"main-grid-message-title",content:BX.create("div",{html:t.TITLE}).innerText})}if(BX.type.isNotEmptyString(t.TEXT)){e.content.push({block:"main-grid-message-text",content:BX.create("div",{html:t.TEXT}).innerText})}n.content.push(e)}));i=BX.decl(n)}return i},getPopup:function t(){if(this.popup===null){this.popup=new BX.PopupWindow(this.getPopupId(),null,{autoHide:true,overlay:.3,minWidth:400,maxWidth:800,contentNoPaddings:true,closeByEsc:true,buttons:[new BX.PopupWindowButton({text:this.parent.getParam("CLOSE"),className:"webform-small-button-blue webform-small-button",events:{click:function t(){this.popupWindow.close()}}})]})}return this.popup},getPopupId:function t(){return this.parent.getContainerId()+"-main-grid-message"}}})();(function(){BX.namespace("BX.Grid");BX.Grid.observer={handlers:[],add:function t(e,i,n,s){BX.bind(e,i,s?BX.proxy(n,s):n)}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Pagesize=function(t){this.parent=null;this.init(t)};BX.Grid.Pagesize.prototype={init:function t(e){this.parent=e;BX.addCustomEvent("Dropdown::change",BX.proxy(this.onChange,this))},destroy:function t(){BX.removeCustomEvent("Dropdown::change",BX.proxy(this.onChange,this))},onChange:function t(e,i,n,s,a){var r=this;if(e===this.parent.getContainerId()+"_"+this.parent.settings.get("pageSizeId")){if(a>=0){this.parent.tableFade();this.parent.getUserOptions().setPageSize(a,(function(){r.parent.reloadTable();BX.onCustomEvent(r.parent.getContainer(),"Grid::pageSizeChanged",[r.parent])}))}}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Pagination=function(t){this.parent=null;this.container=null;this.links=null;this.init(t)};BX.Grid.Pagination.prototype={init:function t(e){this.parent=e},getParent:function t(){return this.parent},getContainer:function t(){if(!this.container){this.container=BX.Grid.Utils.getByClass(this.getParent().getContainer(),this.getParent().settings.get("classPagination"),true)}return this.container},getLinks:function t(){var e=this;var i=BX.Grid.Utils.getByTag(this.getContainer(),"a");this.links=[];if(i){this.links=i.map((function(t){return new BX.Grid.Element(t,e.getParent())}))}return this.links},getLink:function t(e){var i=null;var n;if(BX.type.isDomNode(e)){n=this.getLinks().filter((function(t){return e===t.getNode()}));if(n.length){i=n[0]}}return i}}})();(function(){BX.namespace("BX.Grid");BX.Grid.PinHeader=function(t){this.parent=null;this.table=null;this.header=null;this.container=null;this.parentNodeResizeObserver=null;var e=this.getAdminPanel();if(e){this.mo=new MutationObserver(this.onAdminPanelMutation.bind(this));this.mo.observe(document.documentElement,{attributes:true})}this.init(t)};BX.Grid.PinHeader.prototype={init:function t(e){this.parent=e;this.rect=BX.pos(this.parent.getHead());this.gridRect=BX.pos(this.parent.getTable());var i=BX.Grid.Utils.getBySelector(document,"#workarea-content",true);if(!i){i=this.parent.getContainer().parentNode;i=!!i?i.parentNode:i}if(!!i){this.parentNodeResizeObserver=new BX.ResizeObserver(BX.proxy(this.refreshRect,this));this.parentNodeResizeObserver.observe(i)}this.create(true);document.addEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}));document.addEventListener("resize",BX.proxy(this._onResize,this),BX.Grid.Utils.listenerParams({passive:true}));BX.addCustomEvent("Grid::updated",BX.proxy(this._onGridUpdate,this));BX.addCustomEvent("Grid::resize",BX.proxy(this._onGridUpdate,this));BX.bind(window,"resize",BX.proxy(this._onGridUpdate,this))},refreshRect:function t(){this.gridRect=BX.pos(this.parent.getTable());this.rect=BX.pos(this.parent.getHead())},_onGridUpdate:function t(){var e=this.isPinned();BX.remove(this.getContainer());this.create();e&&this.pin();this.table=null;this.refreshRect();this._onScroll();BX.onCustomEvent(window,"Grid::headerUpdated",[])},create:function t(e){var i=BX.Grid.Utils.getByTag(this.parent.getHead(),"th");var n=BX.clone(this.parent.getHead());var s=BX.Grid.Utils.getByTag(n,"th");var a=function t(){i.forEach((function(t,e){var n=BX.width(t);if(e>0){n-=parseInt(BX.style(t,"border-left-width"));n-=parseInt(BX.style(t,"border-right-width"))}s[e].firstElementChild&&(s[e].firstElementChild.style.width=n+"px");if(i.length-1>e){s[e].style.width=n+"px"}}))};e?setTimeout(a,0):a();this.container=BX.decl({block:"main-grid-fixed-bar",mix:"main-grid-fixed-top",attrs:{style:"width: "+BX.width(this.parent.getContainer())+"px"},content:{block:"main-grid-table",tag:"table",content:n}});this.container.hidden=true;this.parent.getWrapper().appendChild(this.container)},getContainer:function t(){return this.container},getFixedTable:function t(){return this.table||(this.table=BX.Grid.Utils.getByTag(this.getContainer(),"table",true))},getAdminPanel:function t(){if(!this.adminPanel){this.adminPanel=document.querySelector(".adm-header")}return this.adminPanel},isAdminPanelPinned:function t(){return BX.hasClass(document.documentElement,"adm-header-fixed")},getPinOffset:function t(){var e=this.getAdminPanel();if(e&&this.isAdminPanelPinned()){return BX.Text.toNumber(BX.style(e,"height"))}return 0},pin:function t(){var e=this.getContainer();if(e){e.hidden=false}BX.onCustomEvent(window,"Grid::headerPinned",[])},unpin:function t(){var e=this.getContainer();if(e){e.hidden=true}BX.onCustomEvent(window,"Grid::headerUnpinned",[])},stopPin:function t(){BX.Grid.Utils.styleForEach([this.getContainer()],{position:"absolute",top:this.gridRect.bottom-this.rect.height-this.gridRect.top+"px","box-shadow":"none"})},startPin:function t(){BX.Grid.Utils.styleForEach([this.getContainer()],{position:"fixed",top:this.getPinOffset()+"px","box-shadow":""})},isPinned:function t(){return!this.getContainer().hidden},_onScroll:function t(){var e=0;if(this.scrollRect){e=this.scrollRect.scrollTop}else{if(document.scrollingElement){this.scrollRect=document.scrollingElement}else{if(document.documentElement.scrollTop>0){this.scrollRect=document.documentElement}else if(document.body.scrollTop>0){this.scrollRect=document.body}}}if(this.gridRect.bottom>e+this.rect.height){this.startPin();var i=this.getPinOffset();if(this.rect.top-i<=e){!this.isPinned()&&this.pin()}else{this.isPinned()&&this.unpin()}}else{this.stopPin()}},onAdminPanelMutation:function t(){this._onScroll()},_onResize:function t(){this.rect=BX.pos(this.parent.getHead())}}})();(function(){BX.namespace("BX.Grid");BX.Grid.PinPanel=function(t){this.parent=null;this.panel=null;this.isSelected=null;this.offset=null;this.animationDuration=null;this.pinned=false;this.init(t)};BX.Grid.PinPanel.prototype={init:function t(e){this.parent=e;this.offset=10;this.animationDuration=200;this.panel=this.getPanel();this.bindOnRowsEvents()},destroy:function t(){this.unbindOnRowsEvents()},bindOnRowsEvents:function t(){BX.addCustomEvent("Grid::thereSelectedRows",BX.proxy(this._onThereSelectedRows,this));BX.addCustomEvent("Grid::allRowsSelected",BX.proxy(this._onThereSelectedRows,this));BX.addCustomEvent("Grid::noSelectedRows",BX.proxy(this._onNoSelectedRows,this));BX.addCustomEvent("Grid::allRowsUnselected",BX.proxy(this._onNoSelectedRows,this));BX.addCustomEvent("Grid::updated",BX.proxy(this._onNoSelectedRows,this))},unbindOnRowsEvents:function t(){BX.removeCustomEvent("Grid::thereSelectedRows",BX.proxy(this._onThereSelectedRows,this));BX.removeCustomEvent("Grid::allRowsSelected",BX.proxy(this._onThereSelectedRows,this));BX.removeCustomEvent("Grid::noSelectedRows",BX.proxy(this._onNoSelectedRows,this));BX.removeCustomEvent("Grid::allRowsUnselected",BX.proxy(this._onNoSelectedRows,this));BX.removeCustomEvent("Grid::updated",BX.proxy(this._onNoSelectedRows,this))},bindOnWindowEvents:function t(){BX.bind(window,"resize",BX.proxy(this._onResize,this));document.addEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}))},unbindOnWindowEvents:function t(){BX.unbind(window,"resize",BX.proxy(this._onResize,this));document.removeEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}))},getPanel:function t(){this.panel=this.panel||this.parent.getActionsPanel().getPanel();return this.panel},getScrollBottom:function t(){return BX.scrollTop(window)+this.getWindowHeight()},getPanelRect:function t(){if(!BX.type.isPlainObject(this.panelRect)){this.panelRect=BX.pos(this.getPanel())}return this.panelRect},getPanelPrevBottom:function t(){var e=BX.previousSibling(this.getPanel());return BX.pos(e).bottom+parseFloat(BX.style(e,"margin-bottom"))},getWindowHeight:function t(){this.windowHeight=this.windowHeight||BX.height(window);return this.windowHeight},pinPanel:function t(e){var i=this.getPanel();var n=BX.width(this.getPanel().parentNode);var s=BX.height(this.getPanel().parentNode);var a=BX.pos(this.parent.getBody());var r=this.getStartDiffPanelPosition();i.parentNode.style.setProperty("height",s+"px");i.style.setProperty("transform","translateY("+r+"px)");i.classList.add("main-grid-fixed-bottom");i.style.setProperty("width",n+"px");i.style.removeProperty("position");i.style.removeProperty("top");requestAnimationFrame((function(){if(e!==false){i.style.setProperty("transition","transform 200ms ease")}i.style.setProperty("transform","translateY(0)")}));if(this.isNeedPinAbsolute()&&!this.absolutePin){this.absolutePin=true;i.style.removeProperty("transition");i.style.setProperty("position","absolute");i.style.setProperty("top",a.top+"px")}if(!this.isNeedPinAbsolute()&&this.absolutePin){this.absolutePin=false}this.adjustPanelPosition();this.pinned=true},unpinPanel:function t(e){var i=this.getPanel();var n=BX.pos(i);var s=BX.pos(i.parentNode);var a=Math.abs(n.bottom-s.bottom);if(e!==false){i.style.setProperty("transition","transform 200ms ease")}var r=a<n.height?a+"px":"100%";i.style.setProperty("transform","translateY("+r+")");var o=function t(i,n){if(e!==false){return setTimeout(i,n)}i()};o((function(){i.parentNode.style.removeProperty("height");i.classList.remove("main-grid-fixed-bottom");i.style.removeProperty("transition");i.style.removeProperty("transform");i.style.removeProperty("width");i.style.removeProperty("position");i.style.removeProperty("top")}),e!==false?200:0);this.pinned=false},isSelectedRows:function t(){return this.isSelected},isNeedPinAbsolute:function t(){return BX.pos(this.parent.getBody()).top+this.getPanelRect().height>=this.getScrollBottom()},isNeedPin:function t(){return this.getScrollBottom()-this.getPanelRect().height<=this.getPanelPrevBottom()},adjustPanelPosition:function t(){var e=window.pageXOffset;this.lastScrollX=this.lastScrollX!==null?this.lastScrollX:e;BX.Grid.Utils.requestAnimationFrame(BX.proxy((function(){if(e!==this.lastScrollX){var t=this.getPanelRect();BX.style(this.getPanel(),"left",t.left-e+"px")}}),this));this.lastScrollX=e},pinController:function t(e){if(this.getPanel()){if(!this.isPinned()&&this.isNeedPin()&&this.isSelectedRows()){return this.pinPanel(e)}if(this.isPinned()&&!this.isNeedPin()||!this.isSelectedRows()){this.unpinPanel(e)}}},getEndDiffPanelPosition:function t(){var e=BX.pos(this.getPanel());var i=BX.pos(BX.previousSibling(this.getPanel()));var n=BX.scrollTop(window);var s=n+BX.height(window);var a=e.height+this.offset;var r=i.bottom+parseFloat(BX.style(this.getPanel(),"margin-top"));if(r<s&&r+e.height>s){a=Math.abs(s-(r+e.height))}return a},getStartDiffPanelPosition:function t(){var e=BX.pos(this.getPanel());var i=BX.scrollTop(window);var n=i+BX.height(window);var s=e.height;if(e.bottom>n&&e.top<n){s=e.bottom-n}return s},isPinned:function t(){return this.pinned},_onThereSelectedRows:function t(){this.bindOnWindowEvents();this.isSelected=true;if(this.lastIsSelected){this.pinController()}else{this.lastIsSelected=true;this.pinController()}},_onNoSelectedRows:function t(){this.unbindOnWindowEvents();this.isSelected=false;this.pinController();this.lastIsSelected=false},_onScroll:function t(){this.pinController(false)},_onResize:function t(){this.windowHeight=BX.height(window);this.panel=this.parent.getActionsPanel().getPanel();this.panelRect=this.getPanel().getBoundingClientRect();this.pinController(false)}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Resize=function(t){this.parent=null;this.lastRegisterButtons=null;this.init(t)};BX.Grid.Resize.prototype={init:function t(e){this.parent=e;BX.addCustomEvent(window,"Grid::updated",BX.proxy(this.registerTableButtons,this));BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.registerPinnedTableButtons,this));this.registerTableButtons();this.registerPinnedTableButtons()},destroy:function t(){BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this.registerTableButtons,this));BX.removeCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.registerPinnedTableButtons,this));BX.type.isArray(this.lastRegisterButtons)&&this.lastRegisterButtons.forEach(jsDD.unregisterObject);(this.getButtons()||[]).forEach(jsDD.unregisterObject)},registerTableButtons:function t(){(this.getButtons()||[]).forEach(this.register,this);this.registerPinnedTableButtons()},register:function t(e){if(BX.type.isDomNode(e)){e.onbxdragstart=BX.delegate(this._onDragStart,this);e.onbxdragstop=BX.delegate(this._onDragEnd,this);e.onbxdrag=BX.delegate(this._onDrag,this);jsDD.registerObject(e)}},registerPinnedTableButtons:function t(){if(this.parent.getParam("ALLOW_PIN_HEADER")){var e=this.getPinnedTableButtons();if(BX.type.isArray(this.lastRegisterButtons)&&this.lastRegisterButtons.length){this.lastRegisterButtons.forEach(jsDD.unregisterObject)}this.lastRegisterButtons=e;(this.getPinnedTableButtons()||[]).forEach(this.register,this)}},getButtons:function t(){return BX.Grid.Utils.getByClass(this.parent.getRows().getHeadFirstChild().getNode(),this.parent.settings.get("classResizeButton"))},getPinnedTableButtons:function t(){return BX.Grid.Utils.getByClass(this.parent.getPinHeader().getFixedTable(),this.parent.settings.get("classResizeButton"))},_onDragStart:function t(){var e=BX.findParent(jsDD.current_node,{className:this.parent.settings.get("classHeadCell")});var i=this.parent.getRows().getHeadFirstChild().getCells();var n=Object.keys(i);var s;this.__overlay=BX.create("div",{props:{className:"main-grid-cell-overlay"}});BX.append(this.__overlay,e);this.__resizeCell=e.cellIndex;n.forEach((function(t){if(!BX.hasClass(i[t],"main-grid-special-empty")){var e=BX.width(i[t]);if(t>0){e-=parseInt(BX.style(i[t],"border-left-width"));e-=parseInt(BX.style(i[t],"border-right-width"))}BX.width(i[t],e);s=BX.firstChild(i[t]);BX.width(s,e)}}))},_onDrag:function t(e){var i=this.parent.getTable();var n=this.parent.getParam("ALLOW_PIN_HEADER")?this.parent.getPinHeader().getFixedTable():null;var s=i.rows[0].cells[this.__resizeCell];var a,r;var o=BX.pos(s);var l=parseFloat(s.style.width);var d;e-=o.left;d=e;if(o.width>l){e=o.width}e=d>e?d:e;e=Math.max(e,80);if(e!==o.width){var c=this.parent.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;var h=this.parent.getColumnByIndex(this.__resizeCell-c);h.forEach((function(t){t.style.width=e+"px";t.style.minWidth=e+"px";t.style.maxWidth=e+"px";BX.Dom.style(t.firstElementChild,"width",e+"px")}));if(h[0].classList.contains("main-grid-fixed-column")){h=this.parent.getColumnByIndex(this.__resizeCell-c+1);h.forEach((function(t){t.style.width=e+"px";t.style.minWidth=e+"px";t.style.maxWidth=e+"px"}))}this.parent.adjustFixedColumnsPosition();this.parent.adjustFadePosition(this.parent.getFadeOffset());if(BX.type.isDomNode(n)&&BX.type.isDomNode(n.rows[0])){a=n.rows[0].cells[this.__resizeCell];r=BX.firstChild(a);r.style.width=e+"px";r.style.minWidth=e+"px";a.style.width=e+"px";a.style.minWidth=e+"px"}}BX.onCustomEvent(window,"Grid::columnResize",[])},_onDragEnd:function t(){this.saveSizes();var e=BX.findParent(jsDD.current_node,{className:this.parent.settings.get("classHeadCell")});var i=e.querySelector(".main-grid-cell-overlay");if(i){BX.Dom.remove(i)}},getColumnSizes:function t(){var e=this.parent.getRows().getHeadFirstChild().getCells();var i={};var n;[].forEach.call(e,(function(t){n=BX.data(t,"name");if(BX.type.isNotEmptyString(n)){i[n]=BX.width(t)}}),this);return i},saveSizes:function t(){this.parent.getUserOptions().setColumnSizes(this.getColumnSizes(),1)}}})();var _templateObject$1,_templateObject2$1,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15;(function(){BX.namespace("BX.Grid");BX.Grid.Row=function(t,e){this.node=null;this.checkbox=null;this.sort=null;this.actions=null;this.settings=null;this.index=null;this.actionsButton=null;this.parent=null;this.depth=null;this.parentId=null;this.editData=null;this.custom=null;this.onElementClick=this.onElementClick.bind(this);this.init(t,e);this.initElementsEvents()};BX.Grid.Row.prototype={init:function t(e,i){if(BX.type.isDomNode(i)){this.node=i;this.parent=e;this.settings=new BX.Grid.Settings;this.bindNodes=[];if(this.isBodyChild()){this.bindNodes=[].slice.call(this.node.parentNode.querySelectorAll('tr[data-bind="'+this.getId()+'"]'));if(this.bindNodes.length){this.node.addEventListener("mouseover",this.onMouseOver.bind(this));this.node.addEventListener("mouseleave",this.onMouseLeave.bind(this));this.bindNodes.forEach((function(t){t.addEventListener("mouseover",this.onMouseOver.bind(this));t.addEventListener("mouseleave",this.onMouseLeave.bind(this));t.addEventListener("click",function(){if(this.isSelected()){this.unselect()}else{this.select()}}.bind(this))}),this)}}if(this.parent.getParam("ALLOW_CONTEXT_MENU")){BX.bind(this.getNode(),"contextmenu",BX.delegate(this._onRightClick,this))}}},onMouseOver:function t(){this.node.classList.add("main-grid-row-over");this.bindNodes.forEach((function(t){t.classList.add("main-grid-row-over")}))},onMouseLeave:function t(){this.node.classList.remove("main-grid-row-over");this.bindNodes.forEach((function(t){t.classList.remove("main-grid-row-over")}))},isCustom:function t(){if(this.custom===null){this.custom=BX.hasClass(this.getNode(),this.parent.settings.get("classRowCustom"))}return this.custom},_onRightClick:function t(e){e.preventDefault();if(!this.isHeadChild()){this.showActionsMenu(e)}},getDefaultAction:function t(){return BX.data(this.getNode(),"default-action")},getEditorValue:function t(){var e=this;var i=this.getCells();var n={};var s;[].forEach.call(i,(function(t){s=e.getCellEditorValue(t);if(BX.type.isArray(s)){s.forEach((function(t){n[t.NAME]=t.VALUE!==undefined?t.VALUE:"";if(t.hasOwnProperty("RAW_NAME")&&t.hasOwnProperty("RAW_VALUE")){n[t.NAME+"_custom"]=n[t.NAME+"_custom"]||{};n[t.NAME+"_custom"][t.RAW_NAME]=n[t.NAME+"_custom"][t.RAW_NAME]||t.RAW_VALUE}}))}else if(s){n[s.NAME]=s.VALUE!==undefined?s.VALUE:""}}));return n},editGetValues:function t(){return this.getEditorValue()},getCellEditorValue:function t(e){var i=BX.Grid.Utils.getByClass(e,this.parent.settings.get("classEditor"),true);var n=null;if(BX.type.isDomNode(i)){if(BX.hasClass(i,"main-grid-editor-checkbox")){n={NAME:i.getAttribute("name"),VALUE:i.checked?"Y":"N"}}else if(BX.hasClass(i,"main-grid-editor-custom")){n=this.getCustomValue(i)}else if(BX.hasClass(i,"main-grid-editor-money")){n=this.getMoneyValue(i)}else if(BX.hasClass(i,"main-ui-multi-select")){n=this.getMultiSelectValues(i)}else{n=this.getImageValue(i)}}return n},isEdit:function t(){return BX.hasClass(this.getNode(),"main-grid-row-edit")},hide:function t(){BX.addClass(this.getNode(),this.parent.settings.get("classHide"))},show:function t(){BX.Dom.attr(this.getNode(),"hidden",null);BX.removeClass(this.getNode(),this.parent.settings.get("classHide"))},isShown:function t(){return!BX.hasClass(this.getNode(),this.parent.settings.get("classHide"))},isNotCount:function t(){return BX.hasClass(this.getNode(),this.parent.settings.get("classNotCount"))},getContentContainer:function t(e){if(BX.Type.isDomNode(e)){var i=e.closest(".main-grid-cell");if(BX.Type.isDomNode(i)){return i.querySelector(".main-grid-cell-content")}}return e},getContent:function t(e){var i=this.getContentContainer(e);var n;if(BX.type.isDomNode(i)){n=BX.html(i)}return n},getMoneyValue:function t(e){var i=[];var n={PRICE:{},CURRENCY:{},HIDDEN:{}};var s=e.getAttribute("data-name");var a=[].slice.call(e.querySelectorAll("input"));a.forEach((function(t){i.push({NAME:s,RAW_NAME:t.name,RAW_VALUE:t.value||"",VALUE:t.value||""});if(t.classList.contains("main-grid-editor-money-price")){n.PRICE={NAME:t.name,VALUE:t.value}}else if(t.type===" hidden"){n.HIDDEN[t.name]=t.value}}));var r=e.querySelector(".main-grid-editor-dropdown");if(r){var o=r.getAttribute("name");if(BX.type.isNotEmptyString(o)){i.push({NAME:s,RAW_NAME:o,RAW_VALUE:r.dataset.value||"",VALUE:r.dataset.value||""});n.CURRENCY={NAME:o,VALUE:r.dataset.value}}}i.push({NAME:s,VALUE:n});return i},getCustomValue:function t(e){var i=new Map,n=e.getAttribute("data-name");var s=[].slice.call(e.querySelectorAll("input, select, checkbox, textarea"));s.forEach((function(t){var e={NAME:n,RAW_NAME:t.name,RAW_VALUE:t.value,VALUE:t.value};switch(t.tagName){case"SELECT":if(t.multiple){var s=[];t.querySelectorAll("option").forEach((function(t){if(t.selected){s.push(t.value)}}));e["RAW_VALUE"]=s;e["VALUE"]=s;i.set(t.name,e)}else{i.set(t.name,e)}break;case"INPUT":switch(t.type.toUpperCase()){case"RADIO":if(t.checked){e["RAW_VALUE"]=t.value;e["VALUE"]=t.value;i.set(t.name,e)}break;case"CHECKBOX":e["RAW_VALUE"]=t.checked?t.value:"";e["VALUE"]=t.checked?t.value:"";i.set(t.name,e);break;case"FILE":e["RAW_VALUE"]=t.files[0];e["VALUE"]=t.files[0];i.set(t.name,e);break;default:i.set(t.name,e)}break;default:i.set(t.name,e)}}));var a=[];i.forEach((function(t){a.push(t)}));return a},getImageValue:function t(e){var i=null;if(BX.hasClass(e,"main-grid-image-editor")){var n=e.querySelector(".main-grid-image-editor-file-input");if(n){i={NAME:n.name,VALUE:n.files[0]}}else{var s=e.querySelector(".main-grid-image-editor-fake-file-input");if(s){i={NAME:s.name,VALUE:s.value}}}}else if(e.value){i={NAME:e.getAttribute("name"),VALUE:e.value}}else{i={NAME:e.getAttribute("name"),VALUE:BX.data(e,"value")}}return i},getMultiSelectValues:function t(e){var i=JSON.parse(BX.data(e,"value"));return{NAME:e.getAttribute("name"),VALUE:main_core.Type.isArrayFilled(i)?i:""}},getEditorContainer:function t(e){return BX.Grid.Utils.getByClass(e,this.parent.settings.get("classEditorContainer"),true)},getCollapseButton:function t(){if(!this.collapseButton){this.collapseButton=BX.Grid.Utils.getByClass(this.getNode(),this.parent.settings.get("classCollapseButton"),true)}return this.collapseButton},stateLoad:function t(){BX.addClass(this.getNode(),this.parent.settings.get("classRowStateLoad"))},stateUnload:function t(){BX.removeClass(this.getNode(),this.parent.settings.get("classRowStateLoad"))},stateExpand:function t(){BX.addClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},stateCollapse:function t(){BX.removeClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},getParentId:function t(){if(this.parentId===null){this.parentId=BX.data(this.getNode(),"parent-id");if(typeof this.parentId!=="undefined"&&this.parentId!==null){this.parentId=this.parentId.toString()}}return this.parentId},getDataset:function t(){return this.getNode().dataset},getDepth:function t(){if(this.depth===null){this.depth=BX.data(this.getNode(),"depth")}return this.depth},setDepth:function t(e){e=parseInt(e);if(BX.type.isNumber(e)){var i=e-parseInt(this.getDepth());var n=this.parent.getRows();this.getDataset().depth=e;this.getShiftCells().forEach((function(t){BX.data(t,"depth",e);BX.style(t,"padding-left",e*20+"px")}),this);n.getRowsByParentId(this.getId(),true).forEach((function(t){var e=parseInt(i)+parseInt(t.getDepth());t.getDataset().depth=e;t.getShiftCells().forEach((function(t){BX.data(t,"depth",e);BX.style(t,"padding-left",e*20+"px")}))}))}},setParentId:function t(e){this.getDataset()["parentId"]=e},getShiftCells:function t(){return BX.Grid.Utils.getBySelector(this.getNode(),'td[data-shift="true"]')},showChildRows:function t(){var e=this.getChildren();var i=this.isCustom();e.forEach((function(t){t.show();if(!i&&t.isExpand()){t.showChildRows()}}));this.parent.updateCounterDisplayed();this.parent.updateCounterSelected();this.parent.adjustCheckAllCheckboxes();this.parent.adjustRows()},getChildren:function t(){var e=this.isCustom()?"getRowsByGroupId":"getRowsByParentId";var i=this.isCustom()?this.getGroupId():this.getId();return this.parent.getRows()[e](i,true)},hideChildRows:function t(){var e=this.getChildren();e.forEach((function(t){t.hide()}));this.parent.updateCounterDisplayed();this.parent.updateCounterSelected();this.parent.adjustCheckAllCheckboxes();this.parent.adjustRows()},isChildsLoaded:function t(){if(!BX.type.isBoolean(this.childsLoaded)){this.childsLoaded=this.isCustom()||BX.data(this.getNode(),"child-loaded")==="true"}return this.childsLoaded},expand:function t(){var e=this;this.stateExpand();if(this.isChildsLoaded()){this.showChildRows()}else{this.stateLoad();this.loadChildRows((function(t){t.reverse().forEach((function(t){BX.insertAfter(t,e.getNode())}));e.parent.getRows().reset();e.parent.bindOnRowEvents();if(e.parent.getParam("ALLOW_ROWS_SORT")){e.parent.getRowsSortable().reinit()}if(e.parent.getParam("ALLOW_COLUMNS_SORT")){e.parent.getColsSortable().reinit()}e.stateUnload();BX.data(e.getNode(),"child-loaded","true");e.parent.updateCounterDisplayed();e.parent.updateCounterSelected();e.parent.adjustCheckAllCheckboxes()}))}},collapse:function t(){this.stateCollapse();this.hideChildRows()},isExpand:function t(){return BX.hasClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},toggleChildRows:function t(){if(!this.isExpand()){this.expand()}else{this.collapse()}},loadChildRows:function t(e){if(BX.type.isFunction(e)){var i=this;var n=parseInt(this.getDepth());var s=this.parent.getUserOptions().getAction("GRID_GET_CHILD_ROWS");n=BX.type.isNumber(n)?n+1:1;this.parent.getData().request("","POST",{action:s,parent_id:this.getId(),depth:n},null,(function(){var t=this.getRowsByParentId(i.getId());e.apply(null,[t])}))}},update:function t(e,i,n){e=!!e?e:"";var s=this.parent.getUserOptions().getAction("GRID_UPDATE_ROW");var a=this.getDepth();var r=this.getId();var o=this.getParentId();var l={id:r,parentId:o,action:s,depth:a,data:e};var d=this;this.stateLoad();this.parent.getData().request(i,"POST",l,null,(function(){var t=this.getBodyRows();d.parent.getUpdater().updateBodyRows(t);d.stateUnload();d.parent.getRows().reset();d.parent.getUpdater().updateFootRows(this.getFootRows());d.parent.getUpdater().updatePagination(this.getPagination());d.parent.getUpdater().updateMoreButton(this.getMoreButton());d.parent.getUpdater().updateCounterTotal(this.getCounterTotal());d.parent.bindOnRowEvents();d.parent.adjustEmptyTable(t);d.parent.bindOnMoreButtonEvents();d.parent.bindOnClickPaginationLinks();d.parent.updateCounterDisplayed();d.parent.updateCounterSelected();if(d.parent.getParam("ALLOW_COLUMNS_SORT")){d.parent.colsSortable.reinit()}if(d.parent.getParam("ALLOW_ROWS_SORT")){d.parent.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowUpdated",[{id:r,data:e,grid:d.parent,response:this}]);BX.onCustomEvent(window,"Grid::updated",[d.parent]);if(BX.type.isFunction(n)){n({id:r,data:e,grid:d.parent,response:this})}}))},remove:function t(e,i,n){e=!!e?e:"";var s=this.parent.getUserOptions().getAction("GRID_DELETE_ROW");var a=this.getDepth();var r=this.getId();var o=this.getParentId();var l={id:r,parentId:o,action:s,depth:a,data:e};var d=this;this.stateLoad();this.parent.getData().request(i,"POST",l,null,(function(){var t=this.getBodyRows();d.parent.getUpdater().updateBodyRows(t);d.stateUnload();d.parent.getRows().reset();d.parent.getUpdater().updateFootRows(this.getFootRows());d.parent.getUpdater().updatePagination(this.getPagination());d.parent.getUpdater().updateMoreButton(this.getMoreButton());d.parent.getUpdater().updateCounterTotal(this.getCounterTotal());d.parent.bindOnRowEvents();d.parent.adjustEmptyTable(t);d.parent.bindOnMoreButtonEvents();d.parent.bindOnClickPaginationLinks();d.parent.updateCounterDisplayed();d.parent.updateCounterSelected();if(d.parent.getParam("ALLOW_COLUMNS_SORT")){d.parent.colsSortable.reinit()}if(d.parent.getParam("ALLOW_ROWS_SORT")){d.parent.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowRemoved",[{id:r,data:e,grid:d.parent,response:this}]);BX.onCustomEvent(window,"Grid::updated",[d.parent]);if(BX.type.isFunction(n)){n({id:r,data:e,grid:d.parent,response:this})}}))},editCancel:function t(){var e=this.getCells();var i=this;var n;[].forEach.call(e,(function(t){n=i.getEditorContainer(t);if(BX.type.isDomNode(n)){BX.remove(i.getEditorContainer(t));BX.show(i.getContentContainer(t))}}));BX.removeClass(this.getNode(),"main-grid-row-edit")},getCellByIndex:function t(e){return this.getCells()[e]},getEditDataByCellIndex:function getEditDataByCellIndex(index){return eval(BX.data(this.getCellByIndex(index),"edit"))},getCellNameByCellIndex:function t(e){return BX.data(this.getCellByIndex(e),"name")},resetEditData:function t(){this.editData=null},setEditData:function t(e){this.editData=e},getEditData:function t(){if(this.editData===null){var e=this.parent.getParam("EDITABLE_DATA");var i=this.getId();if(BX.type.isPlainObject(e)&&i in e){this.editData=e[i]}else{this.editData={}}}return this.editData},getCellEditDataByCellIndex:function t(e){var i=this.getEditData();var n=null;e=parseInt(e);if(BX.type.isNumber(e)&&BX.type.isPlainObject(i)){var s=this.parent.getRows().getHeadFirstChild().getEditDataByCellIndex(e);if(BX.type.isPlainObject(s)){n=s;n.VALUE=i[s.NAME]}}return n},edit:function t(){var e=this.getCells();var i=this;var n,s,a,r;[].forEach.call(e,(function(t,e){if(t.dataset.editable==="true"){try{n=i.getCellEditDataByCellIndex(e)}catch(t){throw new Error(t)}if(i.parent.getEditor().validateEditObject(n)){r=i.getContentContainer(t);a=BX.height(r);s=i.parent.getEditor().getEditor(n,a);if(!i.getEditorContainer(t)&&BX.type.isDomNode(s)){t.appendChild(s);BX.hide(r)}}}}));BX.addClass(this.getNode(),"main-grid-row-edit")},setDraggable:function t(e){if(!e){BX.addClass(this.getNode(),this.parent.settings.get("classDisableDrag"));this.parent.getRowsSortable().unregister(this.getNode())}else{BX.removeClass(this.getNode(),this.parent.settings.get("classDisableDrag"));this.parent.getRowsSortable().register(this.getNode())}},isDraggable:function t(){return!BX.hasClass(this.getNode(),this.parent.settings.get("classDisableDrag"))},getNode:function t(){return this.node},getIndex:function t(){return this.getNode().rowIndex},getId:function t(){return String(BX.data(this.getNode(),"id"))},getGroupId:function t(){return BX.data(this.getNode(),"group-id").toString()},getObserver:function t(){return BX.Grid.observer},getCheckbox:function t(){if(!this.checkbox){this.checkbox=BX.Grid.Utils.getByClass(this.getNode(),this.settings.get("classRowCheckbox"),true)}return this.checkbox},getActionsMenu:function t(){if(!this.actionsMenu){var e=this.getActionsButton().getBoundingClientRect();this.actionsMenu=BX.PopupMenu.create("main-grid-actions-menu-"+this.getId(),this.getActionsButton(),this.getMenuItems(),{autoHide:true,offsetTop:-(e.height/2+26),offsetLeft:30,angle:{position:"left",offset:e.height/2-8},events:{onPopupClose:BX.delegate(this._onCloseMenu,this),onPopupShow:BX.delegate(this._onPopupShow,this)}});BX.addCustomEvent("Grid::updated",function(){if(this.actionsMenu){this.actionsMenu.destroy();this.actionsMenu=null}}.bind(this));BX.bind(this.actionsMenu.popupWindow.popupContainer,"click",BX.delegate((function(t){var e=this.getActionsMenu();if(e){var i=BX.getEventTarget(t);var n=BX.findParent(i,{className:"menu-popup-item"},10);if(!n||!n.dataset.preventCloseContextMenu){e.close()}}}),this))}return this.actionsMenu},_onCloseMenu:function t(){},_onPopupShow:function t(e){e.setBindElement(this.getActionsButton())},actionsMenuIsShown:function t(){return this.getActionsMenu().popupWindow.isShown()},showActionsMenu:function t(e){BX.fireEvent(document.body,"click");this.getActionsMenu().popupWindow.show();if(e){this.getActionsMenu().popupWindow.popupContainer.style.top=e.pageY-25+BX.PopupWindow.getOption("offsetTop")+"px";this.getActionsMenu().popupWindow.popupContainer.style.left=e.pageX+20+BX.PopupWindow.getOption("offsetLeft")+"px"}},closeActionsMenu:function t(){if(this.actionsMenu){if(this.actionsMenu.popupWindow){this.actionsMenu.popupWindow.close()}}},getMenuItems:function t(){return this.getActions()||[]},getActions:function getActions(){try{this.actions=this.actions||eval(BX.data(this.getActionsButton(),this.settings.get("dataActionsKey")))}catch(t){this.actions=null}return this.actions},getActionsButton:function t(){if(!this.actionsButton){this.actionsButton=BX.Grid.Utils.getByClass(this.getNode(),this.settings.get("classRowActionButton"),true)}return this.actionsButton},initSelect:function t(){if(this.isSelected()&&!BX.hasClass(this.getNode(),this.settings.get("classCheckedRow"))){BX.addClass(this.getNode(),this.settings.get("classCheckedRow"))}},getParentNode:function t(){var e;try{e=this.getNode().parentNode}catch(t){e=null}return e},getParentNodeName:function t(){var e;try{e=this.getParentNode().nodeName}catch(t){e=null}return e},isSelectable:function t(){return!this.isEdit()||this.parent.getParam("ALLOW_EDIT_SELECTION")},select:function t(){var e;if(this.isSelectable()&&(this.parent.getParam("ADVANCED_EDIT_MODE")||!this.parent.getRows().hasEditable())){e=this.getCheckbox();if(e){if(!BX.data(e,"disabled")){BX.addClass(this.getNode(),this.settings.get("classCheckedRow"));this.bindNodes.forEach((function(t){BX.addClass(t,this.settings.get("classCheckedRow"))}),this);e.checked=true}}}},unselect:function t(){if(this.isSelectable()){BX.removeClass(this.getNode(),this.settings.get("classCheckedRow"));this.bindNodes.forEach((function(t){BX.removeClass(t,this.settings.get("classCheckedRow"))}),this);if(this.getCheckbox()){this.getCheckbox().checked=false}}},getCells:function t(){return this.getNode().cells},isSelected:function t(){return this.getCheckbox()&&this.getCheckbox().checked||BX.hasClass(this.getNode(),this.settings.get("classCheckedRow"))},isHeadChild:function t(){return this.getParentNodeName()==="THEAD"&&BX.hasClass(this.getNode(),this.settings.get("classHeadRow"))},isBodyChild:function t(){return BX.hasClass(this.getNode(),this.settings.get("classBodyRow"))&&!BX.hasClass(this.getNode(),this.settings.get("classEmptyRows"))},isFootChild:function t(){return this.getParentNodeName()==="TFOOT"&&BX.hasClass(this.getNode(),this.settings.get("classFootRow"))},prependTo:function t(e){BX.Dom.prepend(this.getNode(),e)},appendTo:function t(e){BX.Dom.append(this.getNode(),e)},setId:function t(e){BX.Dom.attr(this.getNode(),"data-id",e)},setActions:function t(e){var i=this.getNode().querySelector(".main-grid-cell-action");if(i){var n=i.querySelector(".main-grid-row-action-button");if(!n){n=BX.Dom.create({tag:"div",props:{className:"main-grid-row-action-button"}});var s=this.getContentContainer(i);BX.Dom.append(n,s)}BX.Dom.attr(n,{href:"#","data-actions":e});this.actions=e;if(this.actionsMenu){this.actionsMenu.destroy();this.actionsMenu=null}}},makeCountable:function t(){BX.Dom.removeClass(this.getNode(),"main-grid-not-count")},makeNotCountable:function t(){BX.Dom.addClass(this.getNode(),"main-grid-not-count")},getColumnOptions:function t(e){var i=this.parent.getParam("COLUMNS_ALL");if(BX.Type.isPlainObject(i)&&Reflect.has(i,e)){return i[e]}return null},setCellsContent:function t(e){var i=this;var n=this.parent.getRows().getHeadFirstChild();babelHelpers.toConsumableArray(this.getCells()).forEach((function(t,s){var a=n.getCellNameByCellIndex(s);if(Reflect.has(e,a)){var r=i.getColumnOptions(a);var o=i.getContentContainer(t);var l=e[a];if(r.type==="labels"&&BX.Type.isArray(l)){var d=l.map((function(t){var e=BX.Tag.render(_templateObject$1||(_templateObject$1=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="ui-label ','"></span>\n\t\t\t\t\t\t\t'])),t.color);if(t.light!==true){BX.Dom.addClass(e,"ui-label-fill")}if(BX.Type.isPlainObject(t.events)){if(Reflect.has(t.events,"click")){BX.Dom.addClass(e,"ui-label-link")}i.bindOnEvents(e,t.events)}var n=function(){if(BX.Type.isStringFilled(t.html)){return t.html}return t.text}();var s=BX.Tag.render(_templateObject2$1||(_templateObject2$1=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="ui-label-inner">',"</span>\n\t\t\t\t\t\t\t"])),n);BX.Dom.append(s,e);if(BX.Type.isPlainObject(t.removeButton)){var a=function(){if(t.removeButton.type===BX.Grid.Label.RemoveButtonType.INSIDE){return BX.Tag.render(_templateObject3||(_templateObject3=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t\t\t\t<span class="ui-label-icon"></span>\t\n\t\t\t\t\t\t\t\t\t\t'])))}return BX.Tag.render(_templateObject4||(_templateObject4=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t\t\t<span class="main-grid-label-remove-button ','"></span>\t\n\t\t\t\t\t\t\t\t\t'])),t.removeButton.type)}();if(BX.Type.isPlainObject(t.removeButton.events)){i.bindOnEvents(a,t.removeButton.events)}BX.Dom.append(a,e)}return e}));var c=BX.Tag.render(_templateObject5||(_templateObject5=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="main-grid-labels">',"</div>\n\t\t\t\t\t\t"])),d);BX.Dom.clean(o);var h=o.querySelector(".main-grid-labels");if(BX.Type.isDomNode(h)){BX.Dom.replace(h,c)}else{BX.Dom.append(c,o)}}else if(r.type==="tags"&&BX.Type.isPlainObject(l)){var u=l.items.map((function(t){var e=BX.Tag.render(_templateObject6||(_templateObject6=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="main-grid-tag"></span>\n\t\t\t\t\t\t\t'])));i.bindOnEvents(e,t.events);if(t.active===true){BX.Dom.addClass(e,"main-grid-tag-active")}var n=function(){if(BX.Type.isStringFilled(t.html)){return t.html}return BX.Text.encode(t.text)}();var s=BX.Tag.render(_templateObject7||(_templateObject7=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="main-grid-tag-inner">',"</span>\n\t\t\t\t\t\t\t"])),n);BX.Dom.append(s,e);if(t.active===true){var a=BX.Tag.render(_templateObject8||(_templateObject8=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t\t<span class="main-grid-tag-remove"></span>\n\t\t\t\t\t\t\t\t'])));BX.Dom.append(a,e);if(BX.Type.isPlainObject(t.removeButton)){i.bindOnEvents(a,t.removeButton.events)}}return e}));var g=BX.Tag.render(_templateObject9||(_templateObject9=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<span class="main-grid-tags">',"</span>\n\t\t\t\t\t\t"])),u);var p=BX.Tag.render(_templateObject10||(_templateObject10=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<span class="main-grid-tag-add"></span>\n\t\t\t\t\t\t'])));if(BX.Type.isPlainObject(l.addButton)){i.bindOnEvents(p,l.addButton.events)}BX.Dom.append(p,g);var f=o.querySelector(".main-grid-tags");if(BX.Type.isDomNode(f)){BX.Dom.replace(f,g)}else{BX.Dom.append(g,o)}}else{BX.Runtime.html(o,l)}}}))},getCellById:function t(e){var i=this.parent.getRows().getHeadFirstChild();return babelHelpers.toConsumableArray(this.getCells()).find((function(t,n){return i.getCellNameByCellIndex(n)===e}))},isTemplate:function t(){return this.isBodyChild()&&/^template_[0-9]$/.test(this.getId())},enableAbsolutePosition:function t(){var e=babelHelpers.toConsumableArray(this.parent.getRows().getHeadFirstChild().getCells());var i=e.map((function(t){return BX.Dom.style(t,"width")}));var n=this.getCells();i.forEach((function(t,e){BX.Dom.style(n[e],"width",t)}));BX.Dom.style(this.getNode(),"position","absolute")},disableAbsolutePosition:function t(){BX.Dom.style(this.getNode(),"position",null)},getHeight:function t(){return BX.Text.toNumber(BX.Dom.style(this.getNode(),"height"))},setCellActions:function t(e){var i=this;Object.entries(e).forEach((function(t){var e=babelHelpers.slicedToArray(t,2),n=e[0],s=e[1];var a=i.getCellById(n);if(a){var r=a.querySelector(".main-grid-cell-inner");if(r){var o=function(){var t=r.querySelector(".main-grid-cell-content-actions");if(t){BX.Dom.clean(t);return t}var e=BX.Tag.render(_templateObject11||(_templateObject11=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<div class="main-grid-cell-content-actions"></div>\n\t\t\t\t\t\t\t'])));BX.Dom.append(e,r);return e}();if(BX.Type.isArrayFilled(s)){s.forEach((function(t){var e=function(){if(BX.Type.isArrayFilled(t["class"])){return t["class"].join(" ")}return t["class"]}();var n=BX.Tag.render(_templateObject12||(_templateObject12=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t\t<span class="main-grid-cell-content-action ','"></span>\n\t\t\t\t\t\t\t\t'])),e);if(BX.Type.isPlainObject(t.events)){i.bindOnEvents(n,t.events)}if(BX.Type.isPlainObject(t.attributes)){BX.Dom.attr(n,t.attributes)}BX.Dom.append(n,o)}))}}}}))},initElementsEvents:function initElementsEvents(){var _this3=this;var buttons=babelHelpers.toConsumableArray(this.getNode().querySelectorAll(".main-grid-cell [data-events]"));if(BX.Type.isArrayFilled(buttons)){buttons.forEach((function(button){var events=eval(BX.Dom.attr(button,"data-events"));if(BX.Type.isPlainObject(events)){BX.Dom.attr(button,"data-events",null);_this3.bindOnEvents(button,events)}}))}},onElementClick:function t(e){e.stopPropagation()},bindOnEvents:function bindOnEvents(button,events){if(BX.Type.isDomNode(button)&&BX.Type.isPlainObject(events)){BX.Event.bind(button,"click",this.onElementClick.bind(this));var target=function(){var t=BX.Dom.attr(button,"data-target");if(t){return button.closest(t)}return button}();var event=new BX.Event.BaseEvent({data:{button:button,target:target,row:this}});event.setTarget(target);Object.entries(events).forEach((function(_ref3){var _ref4=babelHelpers.slicedToArray(_ref3,2),eventName=_ref4[0],handler=_ref4[1];var preparedHandler=eval(handler);BX.Event.bind(button,eventName,preparedHandler.bind(null,event))}))}},setCounters:function t(e){var i=this;if(BX.Type.isPlainObject(e)){Object.entries(e).forEach((function(t){var e=babelHelpers.slicedToArray(t,2),n=e[0],s=e[1];var a=i.getCellById(n);if(BX.Type.isDomNode(a)){var r=a.querySelector(".main-grid-cell-inner");var o=function(){var t=a.querySelector(".main-grid-cell-counter");if(BX.Type.isDomNode(t)){return t}return BX.Tag.render(_templateObject13||(_templateObject13=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="main-grid-cell-counter"></span>\n\t\t\t\t\t\t\t'])))}();var l=function(){var t=o.querySelector(".ui-counter");if(BX.Type.isDomNode(t)){return t}var e=BX.Tag.render(_templateObject14||(_templateObject14=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="ui-counter"></span>\n\t\t\t\t\t\t\t'])));BX.Dom.append(e,o);return e}();if(BX.Type.isPlainObject(s.events)){i.bindOnEvents(l,s.events)}var d=function(){var t=l.querySelector(".ui-counter-inner");if(BX.Type.isDomNode(t)){return t}var e=BX.Tag.render(_templateObject15||(_templateObject15=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<span class="ui-counter-inner"></span>\n\t\t\t\t\t\t\t'])));BX.Dom.append(e,l);return e}();if(BX.Type.isStringFilled(s.type)){Object.values(BX.Grid.Counters.Type).forEach((function(t){BX.Dom.removeClass(o,"main-grid-cell-counter-".concat(t))}));BX.Dom.addClass(o,"main-grid-cell-counter-".concat(s.type))}if(BX.Type.isStringFilled(s.color)){Object.values(BX.Grid.Counters.Color).forEach((function(t){BX.Dom.removeClass(l,t)}));BX.Dom.addClass(l,s.color)}if(BX.Type.isStringFilled(s.size)){Object.values(BX.Grid.Counters.Size).forEach((function(t){BX.Dom.removeClass(l,t)}));BX.Dom.addClass(l,s.size)}if(BX.Type.isStringFilled(s["class"])){BX.Dom.addClass(l,s["class"])}if(BX.Type.isStringFilled(s.value)||BX.Type.isNumber(s.value)){var c=BX.Text.toNumber(d.innerText);var h=BX.Text.toNumber(s.value);if(h>0){if(h<100){d.innerText=s.value}else{d.innerText="99+"}if(s.animation!==false){if(h!==c){if(h>c){BX.Dom.addClass(d,"ui-counter-plus")}else{BX.Dom.addClass(d,"ui-counter-minus")}}BX.Event.bindOnce(d,"animationend",(function(t){if(t.animationName==="uiCounterPlus"||t.animationName==="uiCounterMinus"){BX.Dom.removeClass(d,["ui-counter-plus","ui-counter-minus"])}}))}}}if(BX.Text.toNumber(s.value)>0){var u=s.type===BX.Grid.Counters.Type.RIGHT?"right":"left";if(u==="left"){BX.Dom.prepend(o,r)}else if(u==="right"){BX.Dom.append(o,r)}}else{var g="main-grid-cell-counter-".concat(BX.Grid.Counters.Type.LEFT_ALIGNED);if(BX.Dom.hasClass(o,g)){BX.remove(l)}else{BX.remove(o)}}}}))}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Rows=function(t){this.parent=null;this.rows=null;this.headChild=null;this.bodyChild=null;this.footChild=null;this.init(t)};BX.Grid.Rows.prototype={init:function t(e){this.parent=e},reset:function t(){this.rows=null;this.headChild=null;this.bodyChild=null;this.footChild=null},enableDragAndDrop:function t(){this.parent.arParams["ALLOW_ROWS_SORT"]=true;if(!(this.parent.getRowsSortable()instanceof BX.Grid.RowsSortable)){this.parent.rowsSortable=new BX.Grid.RowsSortable(this.parent)}},disableDragAndDrop:function t(){this.parent.arParams["ALLOW_ROWS_SORT"]=false;if(this.parent.getRowsSortable()instanceof BX.Grid.RowsSortable){this.parent.getRowsSortable().destroy();this.parent.rowsSortable=null}},getFootLastChild:function t(){return this.getLast(this.getFootChild())},getFootFirstChild:function t(){return this.getFirst(this.getFootChild())},getBodyLastChild:function t(){return this.getLast(this.getBodyChild())},getBodyFirstChild:function t(){return this.getFirst(this.getBodyChild())},getHeadLastChild:function t(){return this.getLast(this.getHeadChild())},getHeadFirstChild:function t(){return this.getFirst(this.getHeadChild())},getEditSelectedValues:function t(e){var i=this.getSelected(e);var n={};i.forEach((function(t){n[t.getId()]=t.editGetValues()}));return n},getSelectedIds:function t(e){return this.getSelected(e).map((function(t){return t.getId()}))},initSelected:function t(){var e=this.getSelected();if(BX.type.isArray(e)&&e.length){e.forEach((function(t){t.initSelect()}));this.parent.enableActionsPanel()}},editSelected:function t(){this.getSelected().forEach((function(t){t.edit()}));BX.onCustomEvent(window,"Grid::thereEditedRows",[])},editSelectedCancel:function t(e){this.getSelected(e).forEach((function(t){t.editCancel()}));BX.onCustomEvent(window,"Grid::noEditedRows",[])},isSelected:function t(){return this.getBodyChild().some((function(t){return t.isShown()&&t.isSelected()}))},isAllSelected:function t(){return!this.getBodyChild().filter((function(t){return!!t.getCheckbox()})).some((function(t){return!t.isSelected()}))},getParent:function t(){return this.parent},getCountSelected:function t(){var e;try{e=this.getSelected().filter((function(t){return!t.isNotCount()&&t.isShown()})).length}catch(t){e=0}return e},getCountDisplayed:function t(){var e;try{e=this.getBodyChild().filter((function(t){return t.isShown()&&!t.isNotCount()})).length}catch(t){e=0}return e},addRows:function t(e){var i=BX.findChild(this.getParent().getTable(),{tag:"TBODY"},true,false);e.forEach((function(t){i.appendChild(t)}))},getRows:function t(){var e;var i=this;if(!this.rows){e=[].slice.call(this.getParent().getTable().querySelectorAll("tr[data-id], thead > tr"));this.rows=e.map((function(t){return new BX.Grid.Row(i.parent,t)}))}return this.rows},getSelected:function t(e){return this.getBodyChild(e).filter((function(t){return t.isShown()&&t.isSelected()}))},normalizeNode:function t(e){if(!BX.hasClass(e,this.getParent().settings.get("classBodyRow"))){e=BX.findParent(e,{className:this.getParent().settings.get("classBodyRow")},true,false)}return e},getById:function t(e){return this.getBodyChild().find((function(t){return String(t.getId())===String(e)}))||null},get:function t(e){if(BX.Type.isDomNode(e)){var i=e.closest(".main-grid-row");if(BX.Type.isDomNode(i)){var n=this.getRows().find((function(t){return t.getNode()===i}));if(n){return n}}}return null},getLast:function t(e){var i;try{i=e[e.length-1]}catch(t){i=null}return i},getFirst:function t(e){var i;try{i=e[0]}catch(t){i=null}return i},getHeadChild:function t(){this.headChild=this.headChild||this.getRows().filter((function(t){return t.isHeadChild()}));return this.headChild},getBodyChild:function t(e){return this.getRows().filter((function(t){return t.isBodyChild()&&(!t.isTemplate()||e)}))},getFootChild:function t(){this.footChild=this.footChild||this.getRows().filter((function(t){return t.isFootChild()}));return this.footChild},selectAll:function t(){this.getRows().map((function(t){t.isShown()&&t.select()}))},unselectAll:function t(){this.getRows().map((function(t){t.unselect()}))},getByIndex:function t(e){var i=this.getBodyChild().filter((function(t){return t})).filter((function(t){return t.getNode().rowIndex===e}));return i.length?i[0]:null},getRowsByParentId:function t(e,i){var n=[];var s=this;if(!e){return n}e=e.toString();function a(t){s.getBodyChild().forEach((function(e){if(e.getParentId()===t){n.push(e);i&&a(e.getId())}}),s)}a(e);return n},getRowsByGroupId:function t(e){var i=[];var n=this;if(!e){return i}e=e.toString();function s(t){n.getBodyChild().forEach((function(e){if(e.getGroupId()===t&&!e.isCustom()){i.push(e)}}),n)}s(e);return i},getExpandedRows:function t(){return this.getRows().filter((function(t){return t.isShown()&&t.isExpand()}))},getIdsExpandedRows:function t(){return this.getExpandedRows().map((function(t){return t.getId()}))},getIdsCollapsedGroups:function t(){return this.getRows().filter((function(t){return t.isCustom()&&!t.isExpand()})).map((function(t){return t.getId()}))},getSourceRows:function t(){return BX.Grid.Utils.getBySelector(this.getParent().getTable(),[".main-grid-header > tr",".main-grid-header + tbody > tr"].join(", "))},getSourceBodyChild:function t(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="TBODY"}))},getSourceHeadChild:function t(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="THEAD"}))},getSourceFootChild:function t(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="TFOOT"}))},hasEditable:function t(){return this.getBodyChild().some((function(t){return t.isEdit()}))},insertAfter:function t(e,i){var n=this.getById(e);var s=this.getById(i);if(n&&s){BX.Dom.insertAfter(n.getNode(),s.getNode());this.reset()}},insertBefore:function t(e,i){var n=this.getById(e);var s=this.getById(i);if(n&&s){BX.Dom.insertBefore(n.getNode(),s.getNode());this.reset()}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.RowDragEvent=function(t){this.allowMoveRow=true;this.allowInsertBeforeTarget=true;this.dragItem=null;this.targetItem=null;this.eventName=!!t?t:"";this.errorMessage=""};BX.Grid.RowDragEvent.prototype={allowMove:function t(){this.allowMoveRow=true;this.errorMessage=""},allowInsertBefore:function t(){this.allowInsertBeforeTarget=true},disallowMove:function t(e){this.allowMoveRow=false;this.errorMessage=e||""},disallowInsertBefore:function t(){this.allowInsertBeforeTarget=false},getDragItem:function t(){return this.dragItem},getTargetItem:function t(){return this.targetItem},getEventName:function t(){return this.eventName},setDragItem:function t(e){return this.dragItem=e},setTargetItem:function t(e){return this.targetItem=e},setEventName:function t(e){return this.eventName=e},isAllowedMove:function t(){return this.allowMoveRow},isAllowedInsertBefore:function t(){return this.allowInsertBeforeTarget},getErrorMessage:function t(){return this.errorMessage}};BX.Grid.RowsSortable=function(t){this.parent=null;this.list=null;this.setDefaultProps();this.init(t)};BX.Grid.RowsSortable.prototype={init:function t(e){this.parent=e;this.list=this.getList();this.prepareListItems();jsDD.Enable();if(!this.inited){this.inited=true;this.onscrollDebounceHandler=BX.debounce(this._onWindowScroll,300,this);if(!this.parent.getParam("ALLOW_ROWS_SORT_IN_EDIT_MODE",false)){BX.addCustomEvent("Grid::thereEditedRows",BX.proxy(this.disable,this));BX.addCustomEvent("Grid::noEditedRows",BX.proxy(this.enable,this))}document.addEventListener("scroll",this.onscrollDebounceHandler,BX.Grid.Utils.listenerParams({passive:true}))}},destroy:function t(){if(!this.parent.getParam("ALLOW_ROWS_SORT_IN_EDIT_MODE",false)){BX.removeCustomEvent("Grid::thereEditedRows",BX.proxy(this.disable,this));BX.removeCustomEvent("Grid::noEditedRows",BX.proxy(this.enable,this))}document.removeEventListener("scroll",this.onscrollDebounceHandler,BX.Grid.Utils.listenerParams({passive:true}));this.unregisterObjects()},_onWindowScroll:function t(){this.windowScrollTop=BX.scrollTop(window);this.rowsRectList=null},disable:function t(){this.unregisterObjects()},enable:function t(){this.reinit()},reinit:function t(){this.unregisterObjects();this.setDefaultProps();this.init(this.parent)},getList:function t(){return this.parent.getRows().getSourceBodyChild()},unregisterObjects:function t(){this.list.forEach(this.unregister,this)},prepareListItems:function t(){this.list.forEach(this.register,this)},register:function t(e){var i=this.parent.getRows();var n=i.get(e);if(n&&n.isDraggable()){e.onbxdragstart=BX.delegate(this._onDragStart,this);e.onbxdrag=BX.delegate(this._onDrag,this);e.onbxdragstop=BX.delegate(this._onDragEnd,this);jsDD.registerObject(e)}},unregister:function t(e){jsDD.unregisterObject(e)},getIndex:function t(e){return BX.Grid.Utils.getIndex(this.list,e)},calcOffset:function t(){var e=this.dragRect.height;if(this.additionalDragItems.length){this.additionalDragItems.forEach((function(t){e+=t.clientHeight}))}return e},getTheadCells:function t(e){return[].map.call(e,(function(t,i){return{block:"",tag:"th",attrs:{style:"width: "+BX.width(e[i])+"px;"}}}))},createFake:function t(){var e=[];this.cloneDragItem=BX.clone(this.dragItem);this.cloneDragAdditionalDragItems=[];this.cloneDragAdditionalDragItemRows=[];var i=this.getTheadCells(this.dragItem.cells);e.push(this.cloneDragItem);this.additionalDragItems.forEach((function(t){var i=BX.clone(t);e.push(i);this.cloneDragAdditionalDragItems.push(i);this.cloneDragAdditionalDragItemRows.push(new BX.Grid.Row(this.parent,i))}),this);var n=BX.width(this.parent.getTable());this.fake=BX.decl({block:"main-grid-fake-container",attrs:{style:"position: absolute; top: "+this.getDragStartRect().top+"px; width: "+n+"px"},content:{block:"main-grid-table",mix:"main-grid-table-fake",tag:"table",attrs:{style:"width: "+n+"px"},content:[{block:"main-grid-header",tag:"thead",content:{block:"main-grid-row-head",tag:"tr",content:i}},{block:"",tag:"tbody",content:e}]}});BX.insertAfter(this.fake,this.parent.getTable());this.cloneDragItem=new BX.Grid.Row(this.parent,this.cloneDragItem);return this.fake},getDragStartRect:function t(){return BX.pos(this.dragItem,this.parent.getTable())},_onDragStart:function t(){this.moved=false;this.dragItem=jsDD.current_node;this.targetItem=this.dragItem;this.additionalDragItems=this.getAdditionalDragItems(this.dragItem);this.dragIndex=this.getIndex(this.dragItem);this.dragRect=this.getRowRect(this.dragItem,this.dragIndex);this.offset=this.calcOffset();this.dragStartOffset=jsDD.start_y-this.dragRect.top;this.dragEvent=new BX.Grid.RowDragEvent;this.dragEvent.setEventName("BX.Main.grid:rowDragStart");this.dragEvent.setDragItem(this.dragItem);this.dragEvent.setTargetItem(this.targetItem);this.dragEvent.allowInsertBefore();var e=this.parent.getRows().get(this.dragItem);this.startDragDepth=e.getDepth();this.startDragParentId=e.getParentId();this.createFake();BX.addClass(this.parent.getContainer(),this.parent.settings.get("classOnDrag"));BX.addClass(this.dragItem,this.parent.settings.get("classDragActive"));BX.onCustomEvent(window,"BX.Main.grid:rowDragStart",[this.dragEvent,this.parent])},getAdditionalDragItems:function t(e){var i=this.parent.getRows();return i.getRowsByParentId(i.get(e).getId(),true).map((function(t){return t.getNode()}))},moveRow:function t(e,i,n){if(!!e){var s=BX.type.isNumber(n)?n:300;e.style.transition=s+"ms";e.style.transform="translate3d(0px, "+i+"px, 0px)"}},getDragOffset:function t(){return jsDD.y-this.dragRect.top-this.dragStartOffset},getWindowScrollTop:function t(){if(this.windowScrollTop===null){this.windowScrollTop=BX.scrollTop(window)}return this.windowScrollTop},getSortOffset:function t(){return jsDD.y},getRowRect:function t(e,i){if(!this.rowsRectList){this.rowsRectList={};this.list.forEach((function(t,e){this.rowsRectList[e]=t.getBoundingClientRect()}),this)}return this.rowsRectList[i]},getRowCenter:function t(e,i){var n=this.getRowRect(e,i);return n.top+this.getWindowScrollTop()+n.height/2},isDragToBottom:function t(e,i){var n=this.getRowCenter(e,i);var s=this.getSortOffset();return i>this.dragIndex&&n<s},isMovedToBottom:function t(e){return e.style.transform==="translate3d(0px, "+-this.offset+"px, 0px)"},isDragToTop:function t(e,i){var n=this.getRowCenter(e,i);var s=this.getSortOffset();return i<this.dragIndex&&n>s},isMovedToTop:function t(e){return e.style.transform==="translate3d(0px, "+this.offset+"px, 0px)"},isDragToBack:function t(e,i){var n=this.getRowCenter(e,i);var s=this.dragIndex;var a=jsDD.y;return i>s&&a<n||i<s&&a>n},isMoved:function t(e){return e.style.transform!=="translate3d(0px, 0px, 0px)"&&e.style.transform!==""},_onDrag:function t(){var e=0;var i=0;this.moveRow(this.dragItem,this.getDragOffset(),e);this.moveRow(this.fake,this.getDragOffset(),e);BX.Grid.Utils.styleForEach(this.additionalDragItems,{transition:e+"ms",transform:"translate3d(0px, "+this.getDragOffset()+"px, 0px)"});this.list.forEach((function(t,e){if(!!t&&t!==this.dragItem&&this.additionalDragItems.indexOf(t)===-1){if(this.isDragToTop(t,e)&&!this.isMovedToTop(t)){this.targetItem=t;this.moveRow(t,this.offset);this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem);this.isDragetToTop=true;this.moved=true}if(this.isDragToBottom(t,e)&&!this.isMovedToBottom(t)){this.targetItem=this.findNextVisible(this.list,e);this.moveRow(t,-this.offset);this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem);this.isDragetToTop=false;if(this.targetItem){this.moved=true}}if(this.isDragToBack(t,e)&&this.isMoved(t)){this.moveRow(t,i);this.targetItem=t;if(this.isDragetToTop){this.targetItem=this.findNextVisible(this.list,e)}this.moved=true;this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem)}}}),this)},createError:function t(e,i){var n=BX.decl({block:"main-grid-error",content:!!i?i:""});!!e&&e.appendChild(n);setTimeout((function(){BX.addClass(n,"main-grid-error-show")}),0);return n},checkError:function t(e){if(!e.isAllowedMove()&&!this.error){this.error=this.createError(this.fake,e.getErrorMessage())}if(e.isAllowedMove()&&this.error){BX.remove(this.error);this.error=null}},findNextVisible:function t(e,i){var n=null;var s=this.parent.getRows();e.forEach((function(t,e){if(!n&&e>i){var a=s.get(t);if(a&&a.isShown()){n=t}}}));return n},updateProperties:function t(e,i){var n=this.parent.getRows();var s=n.get(e);var a=0;var r=0;if(!!i){var o=n.get(i);a=o.getDepth();r=o.getParentId()}s.setDepth(a);s.setParentId(r);this.cloneDragItem.setDepth(a);this.cloneDragAdditionalDragItemRows.forEach((function(t,e){t.setDepth(BX.data(this.additionalDragItems[e],"depth"))}),this)},resetDragProperties:function t(){var e=this.parent.getRows().get(this.dragItem);e.setDepth(this.startDragDepth);e.setParentId(this.startDragParentId)},_onDragOver:function t(){},_onDragLeave:function t(){},_onDragEnd:function t(){BX.onCustomEvent(window,"BX.Main.grid:rowDragEnd",[this.dragEvent,this.parent]);BX.removeClass(this.parent.getContainer(),this.parent.settings.get("classOnDrag"));BX.removeClass(this.dragItem,this.parent.settings.get("classDragActive"));BX.Grid.Utils.styleForEach(this.list,{transition:"",transform:""});if(this.dragEvent.isAllowedMove()){this.sortRows(this.dragItem,this.targetItem);this.sortAdditionalDragItems(this.dragItem,this.additionalDragItems);this.list=this.getList();this.parent.getRows().reset();var e=this.parent.getRows().get(this.dragItem);var i=this.parent.getRows().getBodyChild().map((function(t){return t.getId()}));if(this.parent.getParam("ALLOW_ROWS_SORT_INSTANT_SAVE",true)){this.saveRowsSort(i)}BX.onCustomEvent(window,"Grid::rowMoved",[i,e,this.parent])}else{this.resetDragProperties()}BX.remove(this.fake);this.setDefaultProps()},sortAdditionalDragItems:function t(e,i){i.reduce((function(t,e){!!e&&BX.insertAfter(e,t);return e}),e)},sortRows:function t(e,i){if(!!i){i.parentNode.insertBefore(e,i)}else if(this.moved){e.parentNode.appendChild(e)}},saveRowsSort:function t(e){var i={ids:e,action:this.parent.getUserOptions().getAction("GRID_SAVE_ROWS_SORT")};this.parent.getData().request(null,"POST",i)},setDefaultProps:function t(){this.moved=false;this.dragItem=null;this.targetItem=null;this.dragRect=null;this.dragIndex=null;this.offset=null;this.realX=null;this.realY=null;this.dragStartOffset=null;this.windowScrollTop=null;this.rowsRectList=null;this.error=false}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Settings=function(){this.settings={};this.defaultSettings={classContainer:"main-grid",classWrapper:"main-grid-wrapper",classTable:"main-grid-table",classScrollContainer:"main-grid-container",classFadeContainer:"main-grid-fade",classFadeContainerRight:"main-grid-fade-right",classFadeContainerLeft:"main-grid-fade-left",classNavPanel:"main-grid-nav-panel",classActionPanel:"main-grid-action-panel",classCursor:"main-grid-cursor",classRowCustom:"main-grid-row-custom",classMoreButton:"main-grid-more-btn",classRow:"main-grid-row",classHeadRow:"main-grid-row-head",classBodyRow:"main-grid-row-body",classFootRow:"main-grid-row-foot",classDataRows:"main-grid-row-data",classPanels:"main-grid-bottom-panels",classCellHeadContainer:"main-grid-cell-head-container",classCellHeadOndrag:"main-grid-cell-head-ondrag",classEmptyRows:"main-grid-row-empty",classEmptyBlock:"main-grid-empty-block",classCheckAllCheckboxes:"main-grid-check-all",classCheckedRow:"main-grid-row-checked",classRowCheckbox:"main-grid-row-checkbox",classPagination:"main-grid-panel-cell-pagination",classActionCol:"main-grid-cell-action",classCounterDisplayed:"main-grid-counter-displayed",classCounterSelected:"main-grid-counter-selected",classCounterTotal:"main-grid-panel-total",classTableFade:"main-grid-table-fade",classDragActive:"main-grid-on-row-drag",classResizeButton:"main-grid-resize-button",classOnDrag:"main-grid-ondrag",classDisableDrag:"main-grid-row-drag-disabled",classPanelCellContent:"main-grid-panel-content",classCollapseButton:"main-grid-plus-button",classRowStateLoad:"main-grid-load-row",classRowStateExpand:"main-grid-row-expand",classHeaderSortable:"main-grid-col-sortable",classHeaderNoSortable:"main-grid-col-no-sortable",classCellStatic:"main-grid-cell-static",classHeadCell:"main-grid-cell-head",classPageSize:"main-grid-panel-select-pagesize",classGroupEditButton:"main-grid-control-panel-action-edit",classGroupDeleteButton:"main-grid-control-panel-action-remove",classGroupActionsDisabled:"main-grid-control-panel-action-icon-disable",classPanelButton:"main-grid-buttons",classPanelApplyButton:"main-grid-control-panel-apply-button",classPanelCheckbox:"main-grid-panel-checkbox",classEditor:"main-grid-editor",classEditorContainer:"main-grid-editor-container",classEditorText:"main-grid-editor-text",classEditorDate:"main-grid-editor-date",classEditorNumber:"main-grid-editor-number",classEditorRange:"main-grid-editor-range",classEditorCheckbox:"main-grid-editor-checkbox",classEditorTextarea:"main-grid-editor-textarea",classEditorCustom:"main-grid-editor-custom",classEditorMoney:"main-grid-editor-money",classCellContainer:"main-grid-cell-content",classEditorOutput:"main-grid-editor-output",classSettingsWindow:"main-grid-settings-window",classSettingsWindowColumn:"main-grid-settings-window-list-item",classSettingsWindowColumnLabel:"main-grid-settings-window-list-item-label",classSettingsWindowColumnEditState:"main-grid-settings-window-list-item-edit",classSettingsWindowColumnEditInput:"main-grid-settings-window-list-item-edit-input",classSettingsWindowColumnEditButton:"main-grid-settings-window-list-item-edit-button",classSettingsWindowColumnCheckbox:"main-grid-settings-window-list-item-checkbox",classSettingsWindowShow:"main-grid-settings-window-show",classSettingsWindowSelectAll:"main-grid-settings-window-select-all",classSettingsWindowUnselectAll:"main-grid-settings-window-unselect-all",classSettingsWindowSearchSectionsWrapper:"main-grid-settings-window-search-section-wrapper",classSettingsWindowSearchActiveSectionIcon:"main-grid-settings-window-search-section-item-icon-active",classSettingsWindowSearchSectionInput:"main-grid-settings-window-search-section-input",classSettingsWindowSearchSectionItemHidden:"main-grid-settings-window-list-item-hidden",classSettingsWindowSearchSectionItemVisible:"main-grid-settings-window-list-item-visible",classSettingsButton:"main-grid-interface-settings-icon",classSettingsButtonActive:"main-grid-interface-settings-icon-active",classSettingsWindowClose:"main-grid-settings-window-actions-item-close",classSettingsWindowReset:"main-grid-settings-window-actions-item-reset",classSettingsWindowColumnChecked:"main-grid-settings-window-list-item-checked",classShowAnimation:"main-grid-show-popup-animation",classCloseAnimation:"main-grid-close-popup-animation",classLoader:"main-grid-loader-container",classLoaderShow:"main-grid-show-loader",classLoaderHide:"main-grid-hide-loader",classRowError:"main-grid-error",loaderHideAnimationName:"hideLoader",classHide:"main-grid-hide",classEar:"main-grid-ear",classEarLeft:"main-grid-ear-left",classEarRight:"main-grid-ear-right",classNotCount:"main-grid-not-count",classCounter:"main-grid-panel-counter",classForAllCounterEnabled:"main-grid-panel-counter-for-all-enable",classLoad:"load",classRowActionButton:"main-grid-row-action-button",classDropdown:"main-dropdown",classPanelControl:"main-grid-panel-control",classPanelControlContainer:"main-grid-panel-control-container",classForAllCheckbox:"main-grid-for-all-checkbox",classDisable:"main-grid-disable",dataActionsKey:"actions",updateActionMore:"more",classShow:"show",classGridShow:"main-grid-show",updateActionPagination:"pagination",updateActionSort:"sort",ajaxIdDataProp:"ajaxid",pageSizeId:"grid_page_size",sortableRows:true,sortableColumns:true,animationDuration:300};this.prepare()};BX.Grid.Settings.prototype={prepare:function t(){this.settings=this.defaultSettings},getDefault:function t(){return this.defaultSettings},get:function t(e){var i;try{i=this.getDefault()[e]}catch(t){i=null}return i},getList:function t(){return this.getDefault()}}})();function _createForOfIteratorHelper(t,e){var i=typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=_unsupportedIterableToArray(t))||e&&t&&typeof t.length==="number"){if(i)t=i;var n=0;var s=function t(){};return{s:s,n:function e(){if(n>=t.length)return{done:true};return{done:false,value:t[n++]}},e:function t(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,r=false,o;return{s:function e(){i=i.call(t)},n:function t(){var e=i.next();a=e.done;return e},e:function t(e){r=true;o=e},f:function t(){try{if(!a&&i["return"]!=null)i["return"]()}finally{if(r)throw o}}}}function _unsupportedIterableToArray(t,e){if(!t)return;if(typeof t==="string")return _arrayLikeToArray(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor)i=t.constructor.name;if(i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return _arrayLikeToArray(t,e)}function _arrayLikeToArray(t,e){if(e==null||e>t.length)e=t.length;for(var i=0,n=new Array(e);i<e;i++){n[i]=t[i]}return n}(function(){BX.namespace("BX.Grid");BX.Grid.SettingsWindow=function(t){this.parent=null;this.popupItems=null;this.items=null;this.popup=null;this.sourceContent=null;this.applyButton=null;this.resetButton=null;this.cancelButton=null;this.filterSections=null;this.filterSectionsSearchInput=null;this.init(t);BX.onCustomEvent(window,"BX.Grid.SettingsWindow:init",[this])};BX.Grid.SettingsWindow.prototype={init:function t(e){this.parent=e;BX.bind(this.parent.getContainer(),"click",BX.proxy(this._onContainerClick,this));BX.addCustomEvent(window,"Grid::columnMoved",BX.proxy(this._onColumnMoved,this))},destroy:function t(){BX.unbind(this.parent.getContainer(),"click",BX.proxy(this._onContainerClick,this));BX.removeCustomEvent(window,"Grid::columnMoved",BX.proxy(this._onColumnMoved,this));this.getPopup().close()},getSelectAllButton:function t(){if(!this.selectAllButton){this.selectAllButton=BX.Grid.Utils.getByClass(this.getPopup().contentContainer,this.parent.settings.get("classSettingsWindowSelectAll"),true)}return this.selectAllButton},getUnselectAllButton:function t(){if(!this.unselectAllButton){this.unselectAllButton=BX.Grid.Utils.getByClass(this.getPopup().contentContainer,this.parent.settings.get("classSettingsWindowUnselectAll"),true)}return this.unselectAllButton},reset:function t(){this.popupItems=null;this.allColumns=null;this.items=null},_onContainerClick:function t(e){if(BX.hasClass(e.target,this.parent.settings.get("classSettingsButton"))){this._onSettingsButtonClick(e)}},_onSettingsButtonClick:function t(){BX.onCustomEvent(window,"BX.Grid.SettingsWindow:show",[this]);this.getPopup().show()},fetchColumns:function t(){var e=new BX.Promise;var i=this.parent.getParam("LAZY_LOAD");if(BX.Type.isPlainObject(i)){if(!BX.Type.isNil(i.CONTROLLER)){BX.ajax.runAction("".concat(i.CONTROLLER,".getColumnsList"),{method:"GET",data:{gridId:this.parent.getId()}}).then(e.fulfill.bind(e))}else{BX.ajax({url:this.parent.getParam("LAZY_LOAD")["GET_LIST"],method:"GET",dataType:"json",onsuccess:e.fulfill.bind(e)})}}return e},prepareColumnOptions:function t(e){var i=this.parent.getUserOptions().getCurrentOptions().custom_names;if(BX.type.isPlainObject(e)){if(BX.type.isPlainObject(i)){if(e.id in i){e.name=i[e.id]}}if(this.parent.getColumnHeaderCellByName(e.id)){e.selected=true}}return e},createColumnElement:function t(e){var i='<div data-name="'+e.id+'" class="main-grid-settings-window-list-item">'+'<input id="'+e.id+'-checkbox" type="checkbox" class="main-grid-settings-window-list-item-checkbox"'+(e.selected?" checked":"")+">"+'<label for="'+e.id+'-checkbox" class="main-grid-settings-window-list-item-label">'+e.name+"</label>"+'<span class="main-grid-settings-window-list-item-edit-button"></span>'+"</div>";return BX.create("div",{html:i}).firstElementChild},useLazyLoadColumns:function t(){return!!this.parent.getParam("LAZY_LOAD")},getSourceContent:function t(){if(!this.sourceContent){this.sourceContent=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classSettingsWindow"),true);if(this.useLazyLoadColumns()){this.contentList=this.sourceContent.querySelector(".main-grid-settings-window-list");this.contentList.innerHTML="";var e=new BX.Loader({target:this.contentList});e.show();this.fetchColumns().then(function(t){t.forEach((function(t){t=this.prepareColumnOptions(t);this.contentList.appendChild(this.createColumnElement(t))}),this);e.hide().then((function(){e.destroy()}));this.reset();this.getItems().forEach((function(t){BX.bind(t.getNode(),"click",BX.delegate(this.onItemClick,this))}),this);this.fixedFooter=BX.create("div",{props:{className:"main-grid-popup-window-buttons-wrapper"},children:[this.sourceContent.querySelector(".popup-window-buttons")]});requestAnimationFrame(function(){this.popup.popupContainer.appendChild(this.fixedFooter);this.fixedFooter.style.width=this.popup.popupContainer.clientWidth+"px"}.bind(this))}.bind(this))}}return this.sourceContent},getPopupItems:function t(){var e;if(!this.popupItems){e=this.getPopup().contentContainer;this.popupItems=BX.Grid.Utils.getByClass(e,this.parent.settings.get("classSettingsWindowColumn"))}return this.popupItems},getSelectedColumns:function t(){var e=[];this.getItems().forEach((function(t){t.isSelected()&&e.push(t.getId())}));return e},restoreColumns:function t(){this.getItems().forEach((function(t){t.restore()}));this.sortItems();this.reset()},restoreLastColumns:function t(){this.getItems().forEach((function(t){t.restoreState()}))},updateColumnsState:function t(){this.getItems().forEach((function(t){t.updateState()}))},getStickedColumns:function t(){return this.getItems().reduce((function(t,e){if(e.isSticked()){t.push(e.getId())}return t}),[])},saveColumns:function t(e,i){var n=this.parent.getUserOptions();var s=this.getColumnNames();var a=this.getStickedColumns();var r=[];r.push({action:n.getAction("GRID_SET_COLUMNS"),columns:e.join(",")});r.push({action:n.getAction("SET_CUSTOM_NAMES"),custom_names:s});r.push({action:n.getAction("GRID_SET_STICKED_COLUMNS"),stickedColumns:a});if(this.isForAll()){r.push({action:n.getAction("GRID_SAVE_SETTINGS"),view_id:"default",set_default_settings:"Y",delete_user_settings:"Y"})}n.batch(r,BX.delegate((function(){this.parent.reloadTable(null,null,i)}),this));this.updateColumnsState()},disableAllColumnslabelEdit:function t(){this.getItems().forEach((function(t){t.disableEdit()}))},getAllColumns:function t(){if(!this.allColumns){this.allColumns=this.getItems().map((function(t){return t.getId()}))}return this.allColumns},isShowedColumn:function t(e){return this.getSelectedColumns().some((function(t){return t===e}))},getShowedColumns:function t(){var e=[];var i=this.parent.getRows().getHeadFirstChild().getCells();[].slice.call(i).forEach((function(t){if("name"in t.dataset){e.push(t.dataset.name)}}));return e},sortItems:function t(){var e=this.getShowedColumns();var i={};this.getAllColumns().forEach((function(t){i[t]=t}),this);var n=0;Object.keys(i).forEach((function(t){if(this.isShowedColumn(t)){i[t]=e[n];n++}var s=this.getColumnByName(i[t]);s&&s.parentNode.appendChild(s)}),this)},getColumnNames:function t(){var e={};this.getItems().map((function(t){if(t.isEdited()){e[t.getId()]=t.getTitle()}}));return e},getColumnByName:function t(e){return BX.Grid.Utils.getBySelector(this.getPopup().popupContainer,"."+this.parent.settings.get("classSettingsWindowColumn")+'[data-name="'+e+'"]',true)},_onColumnMoved:function t(){this.sortItems();this.reset()},onResetButtonClick:function t(){this.parent.confirmDialog({CONFIRM:true,CONFIRM_MESSAGE:this.parent.arParams.CONFIRM_RESET_MESSAGE},BX.delegate((function(){this.enableWait(this.getApplyButton());this.parent.getUserOptions().reset(this.isForAll(),BX.delegate((function(){this.parent.reloadTable(null,null,BX.delegate((function(){this.restoreColumns();this.disableWait(this.getApplyButton());this.getPopup().close()}),this))}),this))}),this))},getResetButtonId:function t(){return this.parent.getContainerId()+"-grid-settings-reset-button"},onApplyButtonClick:function t(){this.parent.confirmDialog({CONFIRM:this.isForAll(),CONFIRM_MESSAGE:this.parent.getParam("SETTINGS_FOR_ALL_CONFIRM_MESSAGE")},BX.delegate((function(){this.enableWait(this.getApplyButton());this.saveColumns(this.getSelectedColumns(),BX.delegate((function(){this.getPopup().close();this.disableWait(this.getApplyButton());this.unselectForAllCheckbox()}),this));BX.onCustomEvent(window,"BX.Grid.SettingsWindow:save",[this])}),this),BX.delegate((function(){this.unselectForAllCheckbox()}),this))},getApplyButtonId:function t(){return this.parent.getContainerId()+"-grid-settings-apply-button"},getApplyButton:function t(){if(this.applyButton===null){this.applyButton=BX(this.getApplyButtonId())}return this.applyButton},getCancelButtonId:function t(){return this.parent.getContainerId()+"-grid-settings-cancel-button"},getCancelButton:function t(){if(this.cancelButton===null){this.cancelButton=BX(this.getCancelButtonId())}return this.cancelButton},unselectForAllCheckbox:function t(){var e=this.getForAllCheckbox();e&&(e.checked=null)},enableWait:function t(e){BX.addClass(e,"ui-btn-wait");BX.removeClass(e,"popup-window-button")},disableWait:function t(e){BX.removeClass(e,"ui-btn-wait");BX.addClass(e,"popup-window-button")},createTitle:function t(){var e=BX.create("div");var i=this.parent.getParam("SETTINGS_WINDOW_TITLE");if(i!==""){i="&laquo;"+i+"&raquo;";e.innerHTML="<span>"+this.parent.getParam("SETTINGS_TITLE")+" "+i+"</span>";return e.firstChild.innerText}var n=BX.Main.gridManager.data.length;if(n===1){var s=BX("pagetitle");var a=BX.Type.isDomNode(s)&&BX.Type.isStringFilled(s.innerText)?"&laquo;"+BX.Text.encode(s.innerText)+"&raquo;":"";e.innerHTML="<span>"+this.parent.getParam("SETTINGS_TITLE")+" "+a+"</span>";return e.firstChild.innerText}return this.parent.getParam("SETTINGS_TITLE")},getPopupId:function t(){return this.parent.getContainerId()+"-grid-settings-window"},createPopup:function t(){if(!this.popup){console.log("create popup",document.body.offsetWidth);var e=20;var i=20;var n=document.body.offsetWidth>1e3?1e3:document.body.offsetWidth-e-i;this.popup=new BX.PopupWindow(this.getPopupId(),null,{titleBar:this.createTitle(),autoHide:false,overlay:.6,width:n,closeIcon:true,closeByEsc:true,contentNoPaddings:true,content:this.getSourceContent(),events:{onPopupClose:BX.delegate(this.onPopupClose,this)}});this.getItems().forEach((function(t){BX.bind(t.getNode(),"click",BX.delegate(this.onItemClick,this));BX.bind(t.getNode(),"animationend",this.onAnimationEnd.bind(this,t.getNode()))}),this);BX.bind(this.getResetButton(),"click",BX.proxy(this.onResetButtonClick,this));BX.bind(this.getApplyButton(),"click",BX.proxy(this.onApplyButtonClick,this));BX.bind(this.getCancelButton(),"click",BX.proxy(this.popup.close,this.popup));BX.bind(this.getSelectAllButton(),"click",BX.delegate(this.onSelectAll,this));BX.bind(this.getUnselectAllButton(),"click",BX.delegate(this.onUnselectAll,this));if(this.parent.arParams["COLUMNS_ALL_WITH_SECTIONS"]&&Object.keys(this.parent.arParams["COLUMNS_ALL_WITH_SECTIONS"]).length){this.prepareFilterSections()}if(this.parent.arParams["ENABLE_FIELDS_SEARCH"]){this.prepareFilterSectionsSearchInput()}}return this.popup},onItemClick:function t(){this.adjustActionButtonsState()},onAnimationEnd:function t(e){e.style.display=BX.Dom.hasClass(e,this.parent.settings.get("classSettingsWindowSearchSectionItemHidden"))?"none":"inline-block"},prepareFilterSections:function t(){var e=this.getFilterSections();var i=_createForOfIteratorHelper(e),n;try{for(i.s();!(n=i.n()).done;){var s=n.value;BX.bind(s,"click",this.onFilterSectionClick.bind(this,s))}}catch(t){i.e(t)}finally{i.f()}},getFilterSections:function t(){if(!this.filterSections){var e;var i=BX.Grid.Utils.getByClass(this.getPopup().contentContainer,this.parent.settings.get("classSettingsWindowSearchSectionsWrapper"),true);this.filterSections=(e=i.children)!==null&&e!==void 0?e:new HTMLCollection}return this.filterSections},onFilterSectionClick:function t(e){var i=this.parent.settings.get("classSettingsWindowSearchActiveSectionIcon");var n=e.dataset.uiGridFilterSectionButton;var s=document.querySelectorAll("[data-ui-grid-filter-section='"+n+"']");if(BX.Dom.hasClass(e.firstChild,i)){BX.Dom.removeClass(e.firstChild,i);BX.Dom.hide(s[0])}else{BX.Dom.addClass(e.firstChild,i);BX.Dom.show(s[0])}},prepareFilterSectionsSearchInput:function t(){var e=this.getFilterSectionsSearchInput();BX.bind(e,"input",this.onFilterSectionSearchInput.bind(this));BX.bind(e.previousElementSibling,"click",this.onFilterSectionSearchInputClear.bind(this))},getFilterSectionsSearchInput:function t(){if(!this.filterSectionsSearchInput){this.filterSectionsSearchInput=BX.Grid.Utils.getByClass(this.getPopup().contentContainer,this.parent.settings.get("classSettingsWindowSearchSectionInput"),true)}return this.filterSectionsSearchInput},onFilterSectionSearchInput:function t(){var e=this.filterSectionsSearchInput.value;if(e.length){e=e.toLowerCase()}this.items.forEach(function(t){var i=t.lastTitle.toLowerCase();if(e.length&&i.indexOf(e)===-1){BX.Dom.removeClass(t.getNode(),this.parent.settings.get("classSettingsWindowSearchSectionItemVisible"));BX.Dom.addClass(t.getNode(),this.parent.settings.get("classSettingsWindowSearchSectionItemHidden"))}else{BX.Dom.removeClass(t.getNode(),this.parent.settings.get("classSettingsWindowSearchSectionItemHidden"));BX.Dom.addClass(t.getNode(),this.parent.settings.get("classSettingsWindowSearchSectionItemVisible"));t.getNode().style.display="inline-block"}}.bind(this))},onFilterSectionSearchInputClear:function t(){this.filterSectionsSearchInput.value="";this.onFilterSectionSearchInput()},getItems:function t(){if(this.items===null){this.items=this.getPopupItems().map((function(t){return new BX.Grid.SettingsWindowColumn(this.parent,t)}),this)}return this.items},onPopupClose:function t(){BX.onCustomEvent(window,"BX.Grid.SettingsWindow:close",[this]);this.restoreLastColumns();this.disableAllColumnslabelEdit();this.adjustActionButtonsState()},getPopup:function t(){return!!this.popup?this.popup:this.popup=this.createPopup()},onSelectAll:function t(){this.selectAll();this.enableActions()},onUnselectAll:function t(){this.unselectAll();this.disableActions()},selectAll:function t(){this.getItems().forEach((function(t){t.select()}))},unselectAll:function t(){this.getItems().forEach((function(t){t.unselect()}))},isForAll:function t(){var e=this.getForAllCheckbox();return e&&!!e.checked},getForAllCheckbox:function t(){return BX.Grid.Utils.getByClass(this.getPopup().popupContainer,"main-grid-settings-window-for-all-checkbox",true)},getResetButton:function t(){if(this.resetButton===null){this.resetButton=BX(this.getResetButtonId())}return this.resetButton},disableActions:function t(){var e=this.getApplyButton();if(!!e){BX.addClass(e,this.parent.settings.get("classDisable"))}},enableActions:function t(){var e=this.getApplyButton();if(!!e){BX.removeClass(e,this.parent.settings.get("classDisable"))}},adjustActionButtonsState:function t(){if(this.getSelectedColumns().length){this.enableActions()}else{this.disableActions()}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.SettingsWindowColumn=function(t,e){this.node=null;this.label=null;this.checkbox=null;this.editButton=null;this.settings=null;this.parent=null;this["default"]=null;this.defaultTitle=null;this.state=null;this.lastTitle=null;this.init(t,e)};BX.Grid.SettingsWindowColumn.inited={};BX.Grid.SettingsWindowColumn.prototype={init:function t(e,i){this.parent=e;this.node=i;try{this.lastTitle=i.querySelector("label").innerText.trim()}catch(t){}this.updateState();if(!BX.Grid.SettingsWindowColumn.inited[this.getId()]){BX.Grid.SettingsWindowColumn.inited[this.getId()]=true;BX.bind(this.getEditButton(),"click",BX.proxy(this.onEditButtonClick,this));BX.bind(this.getStickyButton(),"click",BX.proxy(this.onStickyButtonClick,this))}},getStickyButton:function t(){return this.node.querySelector(".main-grid-settings-window-list-item-sticky-button")},isSticked:function t(){return this.node.classList.contains("main-grid-settings-window-list-item-sticked")},onStickyButtonClick:function t(){if(this.isSticked()){this.unstick()}else{this.stick()}},stick:function t(){this.node.classList.add("main-grid-settings-window-list-item-sticked")},unstick:function t(){this.node.classList.remove("main-grid-settings-window-list-item-sticked")},onEditButtonClick:function t(e){e.stopPropagation();this.isEditEnabled()?this.disableEdit():this.enableEdit()},setState:function t(e){this.state=e},getState:function t(){return this.state},updateState:function t(){this.setState({selected:this.isSelected(),sticked:this.isSticked(),title:this.getTitle()})},restoreState:function t(){var e=this.getState();e.selected?this.select():this.unselect();e.sticked?this.stick():this.unstick();this.setTitle(e.title)},getId:function t(){return this.getNode().dataset.name},getTitle:function t(){return this.getLabel().innerText},setTitle:function t(e){this.getLabel().innerText=!!e&&e!=="undefined"?e:this.getDefaultTitle()},isEdited:function t(){return this.getTitle()!==this.getDefaultTitle()},getSettings:function t(){if(this.settings===null){var e=this.parent.getParam("DEFAULT_COLUMNS");this.settings=this.getId()in e?e[this.getId()]:{}}return this.settings},isDefault:function t(){if(this["default"]===null){var e=this.getSettings();this["default"]="default"in e?e["default"]:false}return this["default"]},restore:function t(){this.isDefault()?this.select():this.unselect();this.setTitle(this.getDefaultTitle());this.node.dataset.stickedDefault==="true"?this.stick():this.unstick();this.disableEdit();this.updateState()},getDefaultTitle:function t(){if(this.defaultTitle===null){var e=this.getSettings();this.defaultTitle="name"in e?e.name:this.lastTitle}return this.defaultTitle},getNode:function t(){return this.node},getLabel:function t(){if(this.label===null){this.label=BX.Grid.Utils.getByTag(this.getNode(),"label",true);BX.Event.bind(this.label,"paste",this.onLabelPaste.bind(this));BX.Event.bind(this.label,"keydown",this.onLabelKeydown.bind(this))}return this.label},onLabelPaste:function t(e){e.preventDefault();if(e.clipboardData&&e.clipboardData.getData){var i=e.clipboardData.getData("text/plain");var n=BX.Text.encode(i);var s=n.trim().replace(new RegExp("\t","g")," ").replace(new RegExp("\n","g")," ").replace(/ +(?= )/g,"");document.execCommand("insertHTML",false,s)}},onLabelKeydown:function t(e){if(e.keyCode===13){e.preventDefault()}},getCheckbox:function t(){if(this.checkbox===null){this.checkbox=BX.Grid.Utils.getBySelector(this.getNode(),'input[type="checkbox"]',true)}return this.checkbox},getEditButton:function t(){if(this.editButton===null){this.editButton=BX.Grid.Utils.getByClass(this.getNode(),this.parent.settings.get("classSettingsWindowColumnEditButton"),true)}return this.editButton},enableEdit:function t(){this.getLabel().contentEditable=true;this.getCheckbox().disabled=true;this.adjustCaret()},disableEdit:function t(){this.getLabel().contentEditable=false;this.getCheckbox().disabled=false},isEditEnabled:function t(){return this.getLabel().isContentEditable},isSelected:function t(){return this.getCheckbox().checked},select:function t(){this.getCheckbox().checked=true},unselect:function t(){this.getCheckbox().checked=false},adjustCaret:function t(){var e=document.createRange();var i=window.getSelection();var n=this.getLabel().innerText.length;var s=this.getLabel().childNodes;var a=s[s.length-1];e.setStart(a,n);e.setEnd(a,n);e.collapse(true);i.removeAllRanges();i.addRange(e);BX.fireEvent(this.getNode(),"focus")}}})();(function(){BX.namespace("BX.Grid");BX.Grid.UserOptions=function(t,e,i,n){this.options=null;this.actions=null;this.parent=null;this.url=null;this.init(t,e,i,n)};BX.Grid.UserOptions.prototype={init:function init(parent,userOptions,userOptionsActions,url){this.url=url;this.parent=parent;try{this.options=eval(userOptions)}catch(t){console.warn("BX.Grid.UserOptions.init: Failed parse user options json string")}try{this.actions=eval(userOptionsActions)}catch(t){console.warn("BX.Grid.UserOptions.init: Failed parse user options actions json string")}},getCurrentViewName:function t(){var e=this.getOptions();return"current_view"in e?e.current_view:null},getViewsList:function t(){var e=this.getOptions();return"views"in e?e.views:{}},getCurrentOptions:function t(){var e=this.getCurrentViewName();var i=this.getViewsList();var n=null;if(e in i){n=i[e]}if(!BX.type.isPlainObject(n)){n={}}return n},getUrl:function t(e){return BX.util.add_url_param(this.url,{GRID_ID:this.parent.getContainerId(),bxajaxid:this.parent.getAjaxId(),action:e})},getOptions:function t(){return this.options||{}},getActions:function t(){return this.actions},getAction:function t(e){var i=null;try{i=this.getActions()[e]}catch(t){i=null}return i},update:function t(e){this.options=e},setColumns:function t(e,i){var n=this.getCurrentOptions();if(BX.type.isPlainObject(n)){n.columns=e.join(",");this.save(this.getAction("GRID_SET_COLUMNS"),{columns:n.columns},i)}return this},setColumnsNames:function t(e,i){var n={view_id:"default"};if(BX.type.isPlainObject(n)){n.custom_names=e;this.save(this.getAction("SET_CUSTOM_NAMES"),n,i)}return this},setColumnSizes:function t(e,i){this.save(this.getAction("GRID_SET_COLUMN_SIZES"),{sizes:e,expand:i})},reset:function t(e,i){var n={};if(!!e){n={view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()}}this.save(this.getAction("GRID_RESET"),n,i)},setSort:function t(e,i,n){if(e&&i){this.save(this.getAction("GRID_SET_SORT"),{by:e,order:i},n)}return this},setPageSize:function t(e,i){if(BX.type.isNumber(parseInt(e))){this.save(this.getAction("GRID_SET_PAGE_SIZE"),{pageSize:e},i)}},setExpandedRows:function t(e,i){BX.type.isArray(e)&&this.save(this.getAction("GRID_SET_EXPANDED_ROWS"),{ids:e},i)},setCollapsedGroups:function t(e,i){BX.type.isArray(e)&&this.save(this.getAction("GRID_SET_COLLAPSED_GROUPS"),{ids:e},i)},resetExpandedRows:function t(){this.save(this.getAction("GRID_RESET_EXPANDED_ROWS"),{})},saveForAll:function t(e){this.save(this.getAction("GRID_SAVE_SETTINGS"),{view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()},e)},batch:function t(e,i){this.save(this.getAction("GRID_SAVE_BATH"),{bath:e},i)},save:function t(e,i,n){var s=this;BX.ajax.post(this.getUrl(e),i,(function(t){try{t=JSON.parse(t);if(!t.error){s.update(t);if(BX.type.isFunction(n)){n(t)}BX.onCustomEvent(s.parent.getContainer(),"Grid::optionsChanged",[s.parent])}}catch(t){}}))}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Utils={ajaxUrl:function t(e,i){return this.addUrlParams(e,{bxajaxid:i})},addUrlParams:function t(e,i){return BX.util.add_url_param(e,i)},arrayMove:function t(e,i,n){if(n>=e.length){var s=n-e.length;while(s--+1){e.push(undefined)}}e.splice(n,0,e.splice(i,1)[0]);return e},getIndex:function t(e,i){return[].indexOf.call(e||[],i)},getNext:function t(e){if(e){return e.nextElementSibling||null}},getPrev:function t(e){if(e){return e.previousElementSibling||null}},closestParent:function t(e,i){if(e){if(!i){return e.parentNode||null}else{return BX.findParent(e,{className:i})}}},closestChilds:function t(e){if(e){return e.children||null}},collectionSort:function t(e,i){var n,s,a,r,o;if(e&&i&&e!==i&&e.parentNode===i.parentNode){n=this.closestParent(i);s=this.closestChilds(n);a=s.length;r=this.getIndex(s,e);o=this.getIndex(s,i);if(a===o){n.appendChild(i)}if(r>o){n.insertBefore(e,i)}if(r<o&&a!==o){n.insertBefore(e,this.getNext(i))}}},getColumn:function t(e,i){var n=this.getIndex(this.closestChilds(this.closestParent(i)),i);var s=[];[].forEach.call(e.rows,(function(t){s.push(t.cells[n])}));return s},styleForEach:function t(e,i){i=BX.type.isPlainObject(i)?i:null;var n=Object.keys(i);[].forEach.call(e||[],(function(t){n.forEach((function(e){BX.style(t,e,i[e])}))}))},requestAnimationFrame:function t(){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)};e.apply(window,arguments)},getByClass:function t(e,i,n){var s=[];if(i){s=e?e.getElementsByClassName(i):[];if(n){s=s.length?s[0]:null}else{s=[].slice.call(s)}}return s},getByTag:function t(e,i,n){var s=[];if(i){s=e?e.getElementsByTagName(i):[];if(n){s=s.length?s[0]:null}else{s=[].slice.call(s)}}return s},getBySelector:function t(e,i,n){var s=[];if(i){if(n){s=e?e.querySelector(i):null}else{s=e?e.querySelectorAll(i):[];s=[].slice.call(s)}}return s},listenerParams:function t(e){try{window.addEventListener("test",null,e)}catch(t){e=false}return e}}})();var _templateObject$2,_templateObject2$2,_templateObject3$1,_templateObject4$1,_templateObject5$1;function ownKeys(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach((function(e){babelHelpers.defineProperty(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var Realtime=function(t){babelHelpers.inherits(e,t);function e(t){var i;babelHelpers.classCallCheck(this,e);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(e).call(this));i.setEventNamespace("BX.Grid.Realtime");i.options=_objectSpread({},t);return i}babelHelpers.createClass(e,[{key:"addRow",value:function t(e){var i=this.options.grid;var n=i.getTemplateRow();n.makeCountable();i.hideEmptyStub();if(main_core.Type.isNumber(e.id)||main_core.Type.isStringFilled(e.id)){n.setId(e.id)}else{throw new ReferenceError("id is not number or string")}if(main_core.Type.isArrayFilled(e.actions)){n.setActions(e.actions)}if(main_core.Type.isPlainObject(e.columns)){n.setCellsContent(e.columns)}if(main_core.Type.isPlainObject(e.cellActions)){n.setCellActions(e.cellActions)}if(main_core.Type.isPlainObject(e.counters)){var s=Object.entries(e.counters).reduce((function(t,e){var i=babelHelpers.slicedToArray(e,2),n=i[0],s=i[1];if(main_core.Type.isPlainObject(s)){t[n]=_objectSpread(_objectSpread({},s),{},{animation:main_core.Text.toBoolean(s.animation)})}return t}),{});n.setCounters(s)}if(e.prepend===true){n.prependTo(i.getBody())}else if(e.append===true){n.appendTo(i.getBody())}else if(main_core.Type.isNumber(e.insertBefore)||main_core.Type.isStringFilled(e.insertBefore)){var a=i.getRows().getById(e.insertBefore);if(a){BX.Dom.insertBefore(n.getNode(),a.getNode())}}else if(main_core.Type.isNumber(e.insertAfter)||main_core.Type.isStringFilled(e.insertAfter)){var r=i.getRows().getById(e.insertAfter);if(r){BX.Dom.insertAfter(n.getNode(),r.getNode())}}else{throw new ReferenceError("prepend, append, insertBefore or insertAfter not filled")}n.show();if(e.animation!==false){n.enableAbsolutePosition();var o=i.getRows().getSourceBodyChild().filter((function(t){return t.rowIndex>n.getIndex()}));var l=document.createElement("tr");main_core.Dom.style(l,{height:"0px",transition:"200ms height linear"});main_core.Dom.append(l,i.getBody());var d=n.getHeight();main_core.Dom.style(l,"height","".concat(d,"px"));o.forEach((function(t){main_core.Dom.style(t,{transition:"200ms transform linear",transform:"translateY(".concat(d,"px) translateZ(0)")})}));main_core.Dom.addClass(n.getNode(),"main-ui-grid-show-new-row");main_core.Event.bind(n.getNode(),"animationend",(function(t){if(t.animationName==="showNewRow"){o.forEach((function(t){main_core.Dom.style(t,{transition:null,transform:null})}));main_core.Dom.remove(l);n.disableAbsolutePosition();main_core.Dom.removeClass(n.getNode(),"main-ui-grid-show-new-row")}}))}i.getRows().reset();i.bindOnRowEvents();i.updateCounterDisplayed();i.updateCounterSelected();if(i.getParam("ALLOW_ROWS_SORT")){i.rowsSortable.reinit()}if(i.getParam("ALLOW_COLUMNS_SORT")){i.colsSortable.reinit()}}},{key:"showStub",value:function t(){var e=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var n=document.createElement("tr");main_core.Dom.addClass(n,"main-grid-row main-grid-row-empty main-grid-row-body");var s=document.createElement("td");main_core.Dom.addClass(s,"main-grid-cell main-grid-cell-center");var a=this.options.grid.getRows().getHeadFirstChild().getCells().length;main_core.Dom.attr(s,"colspan",a);var r=function(){if(main_core.Type.isPlainObject(i.content)){var t=[];if(main_core.Type.isStringFilled(i.content.title)){t.push(main_core.Tag.render(_templateObject$2||(_templateObject$2=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="main-grid-empty-block-title">\n\t\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"])),i.content.title))}if(main_core.Type.isStringFilled(i.content.description)){t.push(main_core.Tag.render(_templateObject2$2||(_templateObject2$2=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="main-grid-empty-block-description">\n\t\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"])),i.content.description))}return t}if(main_core.Type.isStringFilled(i.content)||main_core.Type.isDomNode(i.content)){return i.content}return[main_core.Tag.render(_templateObject3$1||(_templateObject3$1=babelHelpers.taggedTemplateLiteral(['<div class="main-grid-empty-image"></div>']))),main_core.Tag.render(_templateObject4$1||(_templateObject4$1=babelHelpers.taggedTemplateLiteral(['<div class="main-grid-empty-text">',"</div>"])),e.options.grid.getParam("EMPTY_STUB_TEXT"))]}();var o=main_core.Tag.render(_templateObject5$1||(_templateObject5$1=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="main-grid-empty-block">\n\t\t\t\t<div class="main-grid-empty-inner">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"])),r);main_core.Dom.append(o,s);main_core.Dom.append(s,n);var l=this.options.grid.getBody().querySelector(".main-grid-row-empty");if(l){main_core.Dom.remove(l)}main_core.Dom.append(n,this.options.grid.getBody());this.options.grid.getRows().getBodyChild().forEach((function(t){t.hide()}));this.options.grid.adjustEmptyTable(this.options.grid.getRows().getSourceBodyChild())}}]);return e}(main_core_events.EventEmitter);var namespace=main_core.Reflection.namespace("BX.Grid");namespace.Realtime=Realtime;var CellActions=function t(){babelHelpers.classCallCheck(this,t)};babelHelpers.defineProperty(CellActions,"PIN","main-grid-cell-content-action-pin");babelHelpers.defineProperty(CellActions,"MUTE","main-grid-cell-content-action-mute");var namespace$1=main_core.Reflection.namespace("BX.Grid");namespace$1.CellActions=CellActions;var CellActionState=function t(){babelHelpers.classCallCheck(this,t)};babelHelpers.defineProperty(CellActionState,"SHOW_BY_HOVER","main-grid-cell-content-action-by-hover");babelHelpers.defineProperty(CellActionState,"ACTIVE","main-grid-cell-content-action-active");var namespace$2=main_core.Reflection.namespace("BX.Grid");namespace$2.CellActionState=CellActionState;var Counters=function t(){babelHelpers.classCallCheck(this,t)};babelHelpers.defineProperty(Counters,"Type",{LEFT:"left",LEFT_ALIGNED:"left-aligned",RIGHT:"right"});babelHelpers.defineProperty(Counters,"Color",{DANGER:"ui-counter-danger",SUCCESS:"ui-counter-success",PRIMARY:"ui-counter-primary",GRAY:"ui-counter-gray",LIGHT:"ui-counter-light",DARK:"ui-counter-dark"});babelHelpers.defineProperty(Counters,"Size",{LARGE:"ui-counter-lg",MEDIUM:"ui-counter-md"});var namespace$3=main_core.Reflection.namespace("BX.Grid");namespace$3.Counters=Counters;var Label=function t(){babelHelpers.classCallCheck(this,t)};babelHelpers.defineProperty(Label,"Color",{DEFAULT:"ui-label-default",DANGER:"ui-label-danger",SUCCESS:"ui-label-success",WARNING:"ui-label-warning",PRIMARY:"ui-label-primary",SECONDARY:"ui-label-secondary",LIGHTGREEN:"ui-label-lightgreen",LIGHTBLUE:"ui-label-lightblue",LIGHT:"ui-label-light"});babelHelpers.defineProperty(Label,"RemoveButtonType",{INSIDE:"main-grid-tag-remove-inside",OUTSIDE:"main-grid-tag-remove-outside"});var namespace$4=main_core.Reflection.namespace("BX.Grid");namespace$4.Label=Label;(function(){BX.namespace("BX.Main");BX.Main.grid=function(t,e,i,n,s,a,r,o,l){BX.Event.EventEmitter.makeObservable(this,"BX.Main.Grid");this.settings=null;this.containerId="";this.container=null;this.wrapper=null;this.fadeContainer=null;this.scrollContainer=null;this.pagination=null;this.moreButton=null;this.table=null;this.rows=null;this.history=false;this.userOptions=null;this.checkAll=null;this.sortable=null;this.updater=null;this.data=null;this.fader=null;this.editor=null;this.isEditMode=null;this.pinHeader=null;this.pinPanel=null;this.arParams=null;this.resize=null;this.editableRows=[];this.init(t,e,i,n,s,a,r,o,l)};BX.Main.grid.prototype={init:function t(e,i,n,s,a,r,o,l,d){this.baseUrl=window.location.pathname+window.location.search;this.container=BX(e);if(!BX.type.isNotEmptyString(e)){throw"BX.Main.grid.init: parameter containerId is empty"}if(BX.type.isPlainObject(i)){this.arParams=i}else{throw new Error("BX.Main.grid.init: arParams isn't object")}this.settings=new BX.Grid.Settings;this.containerId=e;this.userOptions=new BX.Grid.UserOptions(this,n,s,a);this.gridSettings=new BX.Grid.SettingsWindow(this);this.messages=new BX.Grid.Message(this,d);this.cache=new BX.Cache.MemoryCache;if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=new BX.Grid.PinHeader(this);BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.bindOnCheckAll,this))}this.bindOnCheckAll();if(this.getParam("ALLOW_HORIZONTAL_SCROLL")){this.fader=new BX.Grid.Fader(this)}this.pageSize=new BX.Grid.Pagesize(this);this.editor=new BX.Grid.InlineEditor(this,l);if(this.getParam("SHOW_ACTION_PANEL")){this.actionPanel=new BX.Grid.ActionPanel(this,r,o);this.pinPanel=new BX.Grid.PinPanel(this)}this.isEditMode=false;if(!BX.type.isDomNode(this.getContainer())){throw"BX.Main.grid.init: Failed to find container with id "+this.getContainerId()}if(!BX.type.isDomNode(this.getTable())){throw"BX.Main.grid.init: Failed to find table"}this.bindOnRowEvents();if(this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();if(this.getParam("ALLOW_ROWS_SORT")){this.initRowsDragAndDrop()}if(this.getParam("ALLOW_COLUMNS_SORT")){this.initColsDragAndDrop()}this.getRows().initSelected();this.adjustEmptyTable(this.getRows().getSourceBodyChild());BX.onCustomEvent(this.getContainer(),"Grid::ready",[this]);BX.addCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this._onGridUpdated,this));window.frames[this.getFrameId()].onresize=BX.throttle(this._onFrameResize,20,this);if(this.getParam("ALLOW_STICKED_COLUMNS")){this.initStickedColumns()}},destroy:function t(){BX.removeCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::headerPinned",BX.proxy(this.bindOnCheckAll,this));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this._onGridUpdated,this));this.getPinHeader()&&this.getPinHeader().destroy();this.getFader()&&this.getFader().destroy();this.getResize()&&this.getResize().destroy();this.getColsSortable()&&this.getColsSortable().destroy();this.getRowsSortable()&&this.getRowsSortable().destroy();this.getSettingsWindow()&&this.getSettingsWindow().destroy();this.getActionsPanel()&&this.getActionsPanel().destroy();this.getPinPanel()&&this.getPinPanel().destroy();this.getPageSize()&&this.getPageSize().destroy()},_onFrameResize:function t(){BX.onCustomEvent(window,"Grid::resize",[this])},_onGridUpdated:function t(){this.initStickedColumns();this.adjustFadePosition(this.getFadeOffset())},getFrameId:function t(){return"main-grid-tmp-frame-"+this.getContainerId()},enableActionsPanel:function t(){if(this.getParam("SHOW_ACTION_PANEL")){var e=this.getActionsPanel().getPanel();if(BX.type.isDomNode(e)){BX.removeClass(e,this.settings.get("classDisable"))}}},disableActionsPanel:function t(){if(this.getParam("SHOW_ACTION_PANEL")){var e=this.getActionsPanel().getPanel();if(BX.type.isDomNode(e)){BX.addClass(e,this.settings.get("classDisable"))}}},getSettingsWindow:function t(){return this.gridSettings},_onUnselectRows:function t(){var e=this.getActionsPanel();var i;if(e instanceof BX.Grid.ActionPanel){i=e.getForAllCheckbox();if(BX.type.isDomNode(i)){i.checked=null;this.disableForAllCounter()}}this.adjustCheckAllCheckboxes()},isIE:function t(){if(!BX.type.isBoolean(this.ie)){this.ie=BX.hasClass(document.documentElement,"bx-ie")}return this.ie},isTouch:function t(){if(!BX.type.isBoolean(this.touch)){this.touch=BX.hasClass(document.documentElement,"bx-touch")}return this.touch},getParam:function t(e,i){if(i===undefined){i=null}return this.arParams.hasOwnProperty(e)?this.arParams[e]:i},getCounterTotal:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterTotal"),true)},getActionKey:function t(){return"action_button_"+this.getId()},getPinHeader:function t(){if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=this.pinHeader||new BX.Grid.PinHeader(this)}return this.pinHeader},getResize:function t(){if(!(this.resize instanceof BX.Grid.Resize)&&this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}return this.resize},confirmForAll:function t(e){var i;var n=this;if(BX.type.isDomNode(e)){i=BX.Grid.Utils.getByTag(e,"input",true)}if(i.checked){this.getActionsPanel().confirmDialog({CONFIRM:true,CONFIRM_MESSAGE:this.arParams.CONFIRM_FOR_ALL_MESSAGE},(function(){if(BX.type.isDomNode(i)){i.checked=true}n.selectAllCheckAllCheckboxes();n.getRows().selectAll();n.enableForAllCounter();n.updateCounterDisplayed();n.updateCounterSelected();n.enableActionsPanel();n.adjustCheckAllCheckboxes();n.lastRowAction=null;BX.onCustomEvent(window,"Grid::allRowsSelected",[])}),(function(){if(BX.type.isDomNode(i)){i.checked=null;n.disableForAllCounter();n.updateCounterDisplayed();n.updateCounterSelected();n.adjustCheckAllCheckboxes();n.lastRowAction=null}}))}else{this.unselectAllCheckAllCheckboxes();this.adjustCheckAllCheckboxes();this.getRows().unselectAll();this.disableForAllCounter();this.updateCounterDisplayed();this.updateCounterSelected();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[])}},disableCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().disabled=true}))},enableCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().disabled=false}))},indeterminateCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().indeterminate=true}))},determinateCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().indeterminate=false}))},editSelected:function t(){this.disableCheckAllCheckboxes();this.getRows().editSelected();if(this.getParam("ALLOW_PIN_HEADER")){this.getPinHeader()._onGridUpdate()}BX.onCustomEvent(window,"Grid::resize",[this])},editSelectedSave:function t(){var e={FIELDS:this.getRows().getEditSelectedValues(true)};if(this.getParam("ALLOW_VALIDATE")){this.tableFade();e[this.getActionKey()]="validate";this.getData().request("","POST",e,"validate",function(t){t=JSON.parse(t);if(t.messages.length){this.arParams["MESSAGES"]=t.messages;this.messages.show();var i=this.getActionsPanel().getButtons().find((function(t){return t.id==="grid_edit_button_control"}));this.tableUnfade();BX.fireEvent(i,"click")}else{e[this.getActionKey()]="edit";this.reloadTable("POST",e)}}.bind(this));return}if(this.getParam("HANDLE_RESPONSE_ERRORS")){e[this.getActionKey()]="edit";var i=this;this.tableFade();this.getData().request("","POST",e,"",(function(t){try{t=JSON.parse(t)}catch(e){t={messages:[]}}if(t.messages.length){i.arParams["MESSAGES"]=t.messages;i.messages.show();var e=i.getActionsPanel().getButtons().find((function(t){return t.id==="grid_edit_button_control"}));i.tableUnfade();BX.fireEvent(e,"click");return}i.getRows().reset();var n=this.getBodyRows();i.getUpdater().updateContainer(this.getContainer());i.getUpdater().updateHeadRows(this.getHeadRows());i.getUpdater().updateBodyRows(n);i.getUpdater().updateFootRows(this.getFootRows());i.getUpdater().updatePagination(this.getPagination());i.getUpdater().updateMoreButton(this.getMoreButton());i.getUpdater().updateCounterTotal(this.getCounterTotal());i.adjustEmptyTable(n);i.bindOnRowEvents();i.bindOnMoreButtonEvents();i.bindOnClickPaginationLinks();i.bindOnClickHeader();i.bindOnCheckAll();i.updateCounterDisplayed();i.updateCounterSelected();i.disableActionsPanel();i.disableForAllCounter();if(i.getParam("SHOW_ACTION_PANEL")){i.getUpdater().updateGroupActions(this.getActionPanel())}if(i.getParam("ALLOW_COLUMNS_SORT")){i.colsSortable.reinit()}if(i.getParam("ALLOW_ROWS_SORT")){i.rowsSortable.reinit()}i.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[i])}),(function(t){var e=i.getActionsPanel().getButtons().find((function(t){return t.id==="grid_edit_button_control"}));i.tableUnfade();BX.fireEvent(e,"click")}));return}e[this.getActionKey()]="edit";this.reloadTable("POST",e)},getForAllKey:function t(){return"action_all_rows_"+this.getId()},updateRow:function t(e,i,n,s){var a=this.getRows().getById(e);if(a instanceof BX.Grid.Row){a.update(i,n,s)}},removeRow:function t(e,i,n,s){var a=this.getRows().getById(e);if(a instanceof BX.Grid.Row){a.remove(i,n,s)}},addRow:function t(e,i,n){var s=this.getUserOptions().getAction("GRID_ADD_ROW");var a={action:s,data:e};var r=this;this.tableFade();this.getData().request(i,"POST",a,null,(function(){var t=this.getBodyRows();r.getUpdater().updateBodyRows(t);r.tableUnfade();r.getRows().reset();r.getUpdater().updateFootRows(this.getFootRows());r.getUpdater().updatePagination(this.getPagination());r.getUpdater().updateMoreButton(this.getMoreButton());r.getUpdater().updateCounterTotal(this.getCounterTotal());r.bindOnRowEvents();r.adjustEmptyTable(t);r.bindOnMoreButtonEvents();r.bindOnClickPaginationLinks();r.updateCounterDisplayed();r.updateCounterSelected();if(r.getParam("ALLOW_COLUMNS_SORT")){r.colsSortable.reinit()}if(r.getParam("ALLOW_ROWS_SORT")){r.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowAdded",[{data:e,grid:r,response:this}]);BX.onCustomEvent(window,"Grid::updated",[r]);if(BX.type.isFunction(n)){n({data:e,grid:r,response:this})}}))},editSelectedCancel:function t(){this.getRows().editSelectedCancel();if(this.getParam("ALLOW_PIN_HEADER")){this.getPinHeader()._onGridUpdate()}},removeSelected:function t(){var e={ID:this.getRows().getSelectedIds()};var i=this.getActionsPanel().getValues();e[this.getActionKey()]="delete";e[this.getForAllKey()]=this.getForAllKey()in i?i[this.getForAllKey()]:"N";this.reloadTable("POST",e)},sendSelected:function t(){var e=this.getActionsPanel().getValues();var i=this.getRows().getSelectedIds();var n={rows:i,controls:e};this.reloadTable("POST",n)},getActionsPanel:function t(){return this.actionPanel},getPinPanel:function t(){return this.pinPanel},getApplyButton:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanelButton"),true)},getEditor:function t(){return this.editor},reload:function t(e){this.reloadTable("GET",{},null,e)},getPanels:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanels"),true)},getEmptyBlock:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classEmptyBlock"),true)},adjustEmptyTable:function t(e){function i(t){var e=t.currentTarget;BX.style(l,"transform","translate3d("+BX.scrollLeft(e)+"px, 0px, 0")}var n=e.filter((function(t){return BX.Dom.attr(t,"data-id")!=="template_0"&&!BX.Dom.hasClass(t,"main-grid-hide")}));if(!BX.hasClass(document.documentElement,"bx-ie")&&n.length===1&&BX.hasClass(n[0],this.settings.get("classEmptyRows"))){var s=BX.pos(this.getContainer());var a=BX.scrollTop(window)+BX.height(window);var r=s.bottom-a;var o=BX.height(this.getPanels());var l=this.getEmptyBlock();var d=BX.width(this.getContainer());if(d){BX.width(l,d)}BX.style(l,"transform","translate3d("+BX.scrollLeft(this.getScrollContainer())+"px, 0px, 0");BX.unbind(this.getScrollContainer(),"scroll",i);BX.bind(this.getScrollContainer(),"scroll",i);var c=this.getContainer();var h=0;while(c=c.parentElement){var u=parseFloat(BX.style(c,"padding-top"));var g=parseFloat(BX.style(c,"padding-bottom"));if(!isNaN(u)){h+=u}if(!isNaN(g)){h+=g}}if(r>0){BX.style(this.getTable(),"min-height",s.height-r-o-h+"px")}else{BX.style(this.getTable(),"min-height",s.height+Math.abs(r)-o-h+"px")}BX.Dom.addClass(this.getContainer(),"main-grid-empty-stub");if(this.getCurrentPage()<=1){this.hidePanels()}}else{BX.style(this.getTable(),"min-height","");BX.style(this.getTable(),"height","1px");requestAnimationFrame(function(){BX.style(this.getTable(),"height","1px")}.bind(this));this.showPanels();BX.Dom.removeClass(this.getContainer(),"main-grid-empty-stub")}},reloadTable:function t(e,i,n,s){var a;if(!BX.type.isNotEmptyString(e)){e="GET"}if(!BX.type.isPlainObject(i)){i={}}var r=this;this.tableFade();if(!BX.type.isString(s)){s=""}this.getData().request(s,e,i,"",(function(){BX.onCustomEvent(window,"BX.Main.Grid:onBeforeReload",[r]);r.getRows().reset();a=this.getBodyRows();r.getUpdater().updateContainer(this.getContainer());r.getUpdater().updateHeadRows(this.getHeadRows());r.getUpdater().updateBodyRows(a);r.getUpdater().updateFootRows(this.getFootRows());r.getUpdater().updatePagination(this.getPagination());r.getUpdater().updateMoreButton(this.getMoreButton());r.getUpdater().updateCounterTotal(this.getCounterTotal());r.adjustEmptyTable(a);r.bindOnRowEvents();r.bindOnMoreButtonEvents();r.bindOnClickPaginationLinks();r.bindOnClickHeader();r.bindOnCheckAll();r.updateCounterDisplayed();r.updateCounterSelected();r.disableActionsPanel();r.disableForAllCounter();if(r.getParam("SHOW_ACTION_PANEL")){r.getUpdater().updateGroupActions(this.getActionPanel())}if(r.getParam("ALLOW_COLUMNS_SORT")){r.colsSortable.reinit()}if(r.getParam("ALLOW_ROWS_SORT")){r.rowsSortable.reinit()}r.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[r]);if(BX.type.isFunction(n)){n()}if(r.getParam("ALLOW_PIN_HEADER")){r.getPinHeader()._onGridUpdate()}}))},getGroupEditButton:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupEditButton"),true)},getGroupDeleteButton:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupDeleteButton"),true)},enableGroupActions:function t(){var e=this.getGroupEditButton();var i=this.getGroupDeleteButton();if(BX.type.isDomNode(e)){BX.removeClass(e,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(i)){BX.removeClass(i,this.settings.get("classGroupActionsDisabled"))}},disableGroupActions:function t(){var e=this.getGroupEditButton();var i=this.getGroupDeleteButton();if(BX.type.isDomNode(e)){BX.addClass(e,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(i)){BX.addClass(i,this.settings.get("classGroupActionsDisabled"))}},closeActionsMenu:function t(){var e=this.getRows().getRows();for(var i=0,n=e.length;i<n;i++){e[i].closeActionsMenu()}},getPageSize:function t(){return this.pageSize},getFader:function t(){return this.fader},getData:function t(){this.data=this.data||new BX.Grid.Data(this);return this.data},getUpdater:function t(){this.updater=this.updater||new BX.Grid.Updater(this);return this.updater},isSortableHeader:function t(e){return BX.hasClass(e,this.settings.get("classHeaderSortable"))},isNoSortableHeader:function t(e){return BX.hasClass(e,this.settings.get("classHeaderNoSortable"))},bindOnClickHeader:function t(){var e=this;var i;BX.bind(this.getContainer(),"click",(function(t){i=BX.findParent(t.target,{tag:"th"},true,false);if(i&&e.isSortableHeader(i)&&!e.preventSortableClick){var n=new BX.Event.BaseEvent({data:{grid:e,columnName:BX.data(i,"name")}});BX.Event.EventEmitter.emit("BX.Main.grid:onBeforeSort",n);if(n.isDefaultPrevented()){return}e.preventSortableClick=false;e._clickOnSortableHeader(i,t)}}))},enableEditMode:function t(){this.isEditMode=true},disableEditMode:function t(){this.isEditMode=false},isEditMode:function t(){return this.isEditMode},getColumnHeaderCellByName:function t(e){return BX.Grid.Utils.getBySelector(this.getContainer(),"#"+this.getId()+' th[data-name="'+e+'"]',true)},getColumnByName:function t(e){var i=this.getParam("DEFAULT_COLUMNS");return!!e&&e in i?i[e]:null},adjustIndex:function t(e){var i=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;return e+i},getColumnByIndex:function t(e){e=this.adjustIndex(e);return this.getAllRows().reduce((function(t,i){if(!i.classList.contains("main-grid-row-custom")&&!i.classList.contains("main-grid-row-empty")){t.push(i.children[e])}return t}),[])},getAllRows:function t(){var e=[].slice.call(this.getTable().rows);var i=this.getContainer().parentElement.querySelector(".main-grid-fixed-bar table");if(i){e.push(i.rows[0])}return e},initStickedColumns:function t(){[].slice.call(this.getAllRows()[0].children).forEach((function(t,e){if(t.classList.contains("main-grid-sticked-column")){this.stickyColumnByIndex(e)}}),this);if(this.getParam("ALLOW_COLUMNS_RESIZE")){this.getResize().destroy();this.getResize().init(this)}},setStickedColumns:function t(e){if(BX.type.isArray(e)){var i=this.getUserOptions();var n=[{action:i.getAction("GRID_SET_STICKED_COLUMNS"),stickedColumns:e}];i.batch(n,function(){this.reloadTable()}.bind(this))}},getStickedColumns:function t(){var e=[].slice.call(this.getHead().querySelectorAll(".main-grid-cell-head"));return e.reduce(function(t,e){if(BX.hasClass(e,"main-grid-fixed-column")&&!BX.hasClass(e,"main-grid-cell-checkbox")&&!BX.hasClass(e,"main-grid-cell-action")){t.push(e.dataset.name)}return t}.bind(this),[])},stickyColumnByIndex:function t(e){var i=this.getColumnByIndex(e);var n=i[0].clientWidth;var s=i.map((function(t){return BX.height(t)}));i.forEach((function(t,e){t.style.minWidth=n+"px";t.style.width=n+"px";t.style.minHeight=s[e]+"px";var i=BX.clone(t);var a=this.getLastStickyCellFromRowByIndex(e);if(a){var r=parseInt(BX.style(a,"left"));var o=parseInt(BX.style(a,"width"));r=isNaN(r)?0:r;o=isNaN(o)?0:o;t.style.left=r+o+"px"}t.classList.add("main-grid-fixed-column");t.classList.add("main-grid-cell-static");i.classList.add("main-grid-cell-static");if(this.getColsSortable()){this.getColsSortable().unregister(t);this.getColsSortable().unregister(i)}BX.insertAfter(i,t)}),this);this.adjustFadePosition(this.getFadeOffset())},adjustFixedColumnsPosition:function t(){var e=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;var i=[].slice.call(this.getAllRows()[0].children).reduce((function(t,e,i,n){var s;var a;if(n[i-1]&&n[i-1].classList.contains("main-grid-fixed-column")){s=parseInt(BX.style(n[i-1],"left"));a=parseInt(BX.style(n[i-1],"width"));s=isNaN(s)?0:s;a=isNaN(a)?0:a;t.push({index:i+1,left:s+a})}return t}),[]);i.forEach((function(t){var n=this.getColumnByIndex(t.index-e);n.forEach((function(e){if(t.index!==i[i.length-1].index){e.style.left=t.left+"px"}}))}),this);this.getAllRows().forEach((function(t){var e=BX.height(t);var i=[].slice.call(t.children);i.forEach((function(t){t.style.minHeight=e+"px"}))}))},getLastStickyCellFromRowByIndex:function t(e){return[].slice.call(this.getAllRows()[e].children).reduceRight((function(t,e){if(!t&&e.classList.contains("main-grid-fixed-column")){t=e}return t}),null)},getFadeOffset:function t(){var e=0;var i=this.getLastStickyCellFromRowByIndex(0);if(i){var n=parseInt(BX.style(i,"left"));var s=i.offsetWidth;n=isNaN(n)?0:n;s=isNaN(s)?0:s;e=n+s}return e},adjustFadePosition:function t(e){var i=this.getFader().getEarLeft();var n=this.getFader().getShadowLeft();i.style.left=e+"px";n.style.left=e+"px"},sortByColumn:function t(e){var i=null;var n=null;if(!BX.type.isPlainObject(e)){i=this.getColumnHeaderCellByName(e);n=this.getColumnByName(e)}else{n=e;n.sort_url=this.prepareSortUrl(e)}if(n&&(!!i&&!BX.hasClass(i,this.settings.get("classLoad"))||!i)){!!i&&BX.addClass(i,this.settings.get("classLoad"));this.tableFade();var s=this;this.getUserOptions().setSort(n.sort_by,n.sort_order,(function(){s.getData().request(n.sort_url,null,null,"sort",(function(){s.rows=null;s.getUpdater().updateHeadRows(this.getHeadRows());s.getUpdater().updateBodyRows(this.getBodyRows());s.getUpdater().updatePagination(this.getPagination());s.getUpdater().updateMoreButton(this.getMoreButton());s.bindOnRowEvents();s.bindOnMoreButtonEvents();s.bindOnClickPaginationLinks();s.bindOnCheckAll();s.updateCounterDisplayed();s.updateCounterSelected();s.disableActionsPanel();s.disableForAllCounter();if(s.getParam("SHOW_ACTION_PANEL")){s.getActionsPanel().resetForAllCheckbox()}if(s.getParam("ALLOW_ROWS_SORT")){s.rowsSortable.reinit()}if(s.getParam("ALLOW_COLUMNS_SORT")){s.colsSortable.reinit()}BX.onCustomEvent(window,"BX.Main.grid:sort",[n,s]);BX.onCustomEvent(window,"Grid::updated",[s]);s.tableUnfade()}))}))}},prepareSortUrl:function t(e){var i=window.location.toString();if("sort_by"in e){i=BX.util.add_url_param(i,{by:e.sort_by})}if("sort_order"in e){i=BX.util.add_url_param(i,{order:e.sort_order})}return i},_clickOnSortableHeader:function t(e,i){i.preventDefault();this.sortByColumn(BX.data(e,"name"))},getObserver:function t(){return BX.Grid.observer},initRowsDragAndDrop:function t(){this.rowsSortable=new BX.Grid.RowsSortable(this)},initColsDragAndDrop:function t(){this.colsSortable=new BX.Grid.ColsSortable(this)},getRowsSortable:function t(){return this.rowsSortable},getColsSortable:function t(){return this.colsSortable},getUserOptionsHandlerUrl:function t(){return this.userOptionsHandlerUrl||""},getUserOptions:function t(){return this.userOptions},getCheckAllCheckboxes:function t(){var e=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCheckAllCheckboxes"));return e.map((function(t){return new BX.Grid.Element(t)}))},selectAllCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().checked=true}))},unselectAllCheckAllCheckboxes:function t(){this.getCheckAllCheckboxes().forEach((function(t){t.getNode().checked=false}))},adjustCheckAllCheckboxes:function t(){var e=this.getRows().getBodyChild().filter((function(t){return t.isShown()&&!!t.getCheckbox()})).length;var i=this.getRows().getSelected().filter((function(t){return t.isShown()})).length;if(e>0&&i>0&&e===i){this.selectAllCheckAllCheckboxes()}else{this.unselectAllCheckAllCheckboxes()}if(i>0&&i<e){this.indeterminateCheckAllCheckboxes()}else{this.determinateCheckAllCheckboxes()}},bindOnCheckAll:function t(){var e=this;this.getCheckAllCheckboxes().forEach((function(t){t.getObserver().add(t.getNode(),"change",e._clickOnCheckAll,e)}))},_clickOnCheckAll:function t(e){e.preventDefault();this.toggleSelectionAll();this.determinateCheckAllCheckboxes()},toggleSelectionAll:function t(){if(!this.getRows().isAllSelected()&&(this.lastRowAction==="select"||!this.lastRowAction)){this.getRows().selectAll();this.selectAllCheckAllCheckboxes();this.enableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsSelected",[this])}else{this.getRows().unselectAll();this.unselectAllCheckAllCheckboxes();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[this])}delete this.lastRowAction;this.updateCounterSelected()},bindOnClickPaginationLinks:function t(){var e=this;this.getPagination().getLinks().forEach((function(t){t.getObserver().add(t.getNode(),"click",e._clickOnPaginationLink,e)}))},bindOnMoreButtonEvents:function t(){var e=this;this.getMoreButton().getObserver().add(this.getMoreButton().getNode(),"click",e._clickOnMoreButton,e)},bindOnRowEvents:function t(){var e=this.getObserver();var i=this.getParam("SHOW_ROW_CHECKBOXES");var n=this.getParam("ENABLE_COLLAPSIBLE_ROWS");this.getRows().getBodyChild().forEach((function(t){i&&e.add(t.getNode(),"click",this._onClickOnRow,this);t.getDefaultAction()&&e.add(t.getNode(),"dblclick",this._onRowDblclick,this);t.getActionsButton()&&e.add(t.getActionsButton(),"click",this._clickOnRowActionsButton,this);n&&t.getCollapseButton()&&e.add(t.getCollapseButton(),"click",this._onCollapseButtonClick,this)}),this)},_onCollapseButtonClick:function t(e){e.preventDefault();e.stopPropagation();var i=this.getRows().get(e.currentTarget);i.toggleChildRows();if(i.isCustom()){this.getUserOptions().setCollapsedGroups(this.getRows().getIdsCollapsedGroups())}else{this.getUserOptions().setExpandedRows(this.getRows().getIdsExpandedRows())}BX.fireEvent(document.body,"click")},_clickOnRowActionsButton:function t(e){var i=this.getRows().get(e.target);e.preventDefault();if(!i.actionsMenuIsShown()){i.showActionsMenu()}else{i.closeActionsMenu()}},_onRowDblclick:function _onRowDblclick(event){event.preventDefault();var row=this.getRows().get(event.target);var defaultJs="";if(!row.isEdit()){clearTimeout(this.clickTimer);this.clickPrevent=true;try{defaultJs=row.getDefaultAction();eval(defaultJs)}catch(t){console.warn(t)}}},_onClickOnRow:function t(e){var i=50;var n=window.getSelection();if(e.target.nodeName==="LABEL"){e.preventDefault()}if(e.shiftKey||n.toString().length===0){if(e.shiftKey){n.removeAllRanges()}this.clickTimer=setTimeout(BX.delegate((function(){if(!this.clickPrevent){s.apply(this,[e])}this.clickPrevent=false}),this),i)}function s(t){var e,i,n,s,a,r;var o=true;if(t.target.nodeName!=="A"&&t.target.nodeName!=="INPUT"){i=this.getRows().get(t.target);if(i){r=i.getContentContainer(t.target);if(BX.type.isDomNode(r)&&t.target.nodeName!=="TD"&&t.target!==r){o=BX.data(r,"prevent-default")==="true"}if(o){if(i.getCheckbox()){e=[];this.currentIndex=0;this.getRows().getRows().forEach((function(t,e){if(t===i){this.currentIndex=e}}),this);this.lastIndex=this.lastIndex||this.currentIndex;if(!t.shiftKey){if(!i.isSelected()){this.lastRowAction="select";i.select();BX.onCustomEvent(window,"Grid::selectRow",[i,this])}else{this.lastRowAction="unselect";i.unselect();BX.onCustomEvent(window,"Grid::unselectRow",[i,this])}}else{s=Math.min(this.currentIndex,this.lastIndex);a=Math.max(this.currentIndex,this.lastIndex);while(s<=a){e.push(this.getRows().getRows()[s]);s++}n=e.some((function(t){return!t.isSelected()}));if(n){e.forEach((function(t){t.select()}));this.lastRowAction="select";BX.onCustomEvent(window,"Grid::selectRows",[e,this])}else{e.forEach((function(t){t.unselect()}));this.lastRowAction="unselect";BX.onCustomEvent(window,"Grid::unselectRows",[e,this])}}this.updateCounterSelected();this.lastIndex=this.currentIndex}this.adjustRows();this.adjustCheckAllCheckboxes()}}}}},adjustRows:function t(){if(this.getRows().isSelected()){BX.onCustomEvent(window,"Grid::thereSelectedRows",[this]);this.enableActionsPanel()}else{BX.onCustomEvent(window,"Grid::noSelectedRows",[]);this.disableActionsPanel()}},getPagination:function t(){return new BX.Grid.Pagination(this)},getState:function t(){return window.history.state},tableFade:function t(){BX.addClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().show();BX.onCustomEvent("Grid::disabled",[this])},tableUnfade:function t(){BX.removeClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().hide();BX.onCustomEvent("Grid::enabled",[this])},_clickOnPaginationLink:function t(e){e.preventDefault();var i=this;var n=this.getPagination().getLink(e.target);if(!n.isLoad()){this.getUserOptions().resetExpandedRows();n.load();this.tableFade();this.getData().request(n.getLink(),null,null,"pagination",(function(){i.rows=null;i.getUpdater().updateBodyRows(this.getBodyRows());i.getUpdater().updateHeadRows(this.getHeadRows());i.getUpdater().updateMoreButton(this.getMoreButton());i.getUpdater().updatePagination(this.getPagination());i.bindOnRowEvents();i.bindOnMoreButtonEvents();i.bindOnClickPaginationLinks();i.bindOnCheckAll();i.updateCounterDisplayed();i.updateCounterSelected();i.disableActionsPanel();i.disableForAllCounter();if(i.getParam("SHOW_ACTION_PANEL")){i.getActionsPanel().resetForAllCheckbox()}if(i.getParam("ALLOW_ROWS_SORT")){i.rowsSortable.reinit()}if(i.getParam("ALLOW_COLUMNS_SORT")){i.colsSortable.reinit()}n.unload();i.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[i])}))}},_clickOnMoreButton:function t(e){e.preventDefault();var i=this;var n=this.getMoreButton();n.load();this.getData().request(n.getLink(),null,null,"more",(function(){i.getUpdater().appendBodyRows(this.getBodyRows());i.getUpdater().updateMoreButton(this.getMoreButton());i.getUpdater().updatePagination(this.getPagination());i.getRows().reset();i.bindOnRowEvents();i.bindOnMoreButtonEvents();i.bindOnClickPaginationLinks();i.bindOnCheckAll();i.updateCounterDisplayed();i.updateCounterSelected();if(i.getParam("ALLOW_PIN_HEADER")){i.getPinHeader()._onGridUpdate()}if(i.getParam("ALLOW_ROWS_SORT")){i.rowsSortable.reinit()}if(i.getParam("ALLOW_COLUMNS_SORT")){i.colsSortable.reinit()}i.unselectAllCheckAllCheckboxes()}))},getAjaxId:function t(){return BX.data(this.getContainer(),this.settings.get("ajaxIdDataProp"))},update:function t(e,i){var n,s,a,r,o,l;if(!BX.type.isNotEmptyString(e)){return}r=BX.Grid.Utils.getByTag(this.getTable(),"tbody",true);o=BX.Grid.Utils.getByTag(this.getTable(),"thead",true);l=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classNavPanel"),true);e=BX.create("div",{html:e});s=BX.Grid.Utils.getByClass(e,this.settings.get("classHeadRow"));n=BX.Grid.Utils.getByClass(e,this.settings.get("classDataRows"));a=BX.Grid.Utils.getByClass(e,this.settings.get("classNavPanel"),true);if(i===this.settings.get("updateActionMore")){this.getRows().addRows(n);this.unselectAllCheckAllCheckboxes()}if(i===this.settings.get("updateActionPagination")){BX.cleanNode(r);this.getRows().addRows(n);this.unselectAllCheckAllCheckboxes()}if(i===this.settings.get("updateActionSort")){BX.cleanNode(o);BX.cleanNode(r);o.appendChild(s[0]);this.getRows().addRows(n)}l.innerHTML=a.innerHTML;this.bindOnRowEvents();this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();this.bindOnCheckAll();this.updateCounterDisplayed();this.updateCounterSelected();this.sortable.reinit()},getCounterDisplayed:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterDisplayed"))},getCounterSelected:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterSelected"))},updateCounterDisplayed:function t(){var e=this.getCounterDisplayed();var i;if(BX.type.isArray(e)){i=this.getRows();e.forEach((function(t){if(BX.type.isDomNode(t)){t.innerText=i.getCountDisplayed()}}),this)}},updateCounterSelected:function t(){var e=this.getCounterSelected();var i;if(BX.type.isArray(e)){i=this.getRows();e.forEach((function(t){if(BX.type.isDomNode(t)){t.innerText=i.getCountSelected()}}),this)}},getContainerId:function t(){return this.containerId},getId:function t(){return this.containerId},getContainer:function t(){return BX(this.getContainerId())},getCounter:function t(){if(!this.counter){this.counter=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounter"))}return this.counter},enableForAllCounter:function t(){var e=this.getCounter();if(BX.type.isArray(e)){e.forEach((function(t){BX.addClass(t,this.settings.get("classForAllCounterEnabled"))}),this)}},disableForAllCounter:function t(){var e=this.getCounter();if(BX.type.isArray(e)){e.forEach((function(t){BX.removeClass(t,this.settings.get("classForAllCounterEnabled"))}),this)}},getScrollContainer:function t(){if(!this.scrollContainer){this.scrollContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classScrollContainer"),true)}return this.scrollContainer},getWrapper:function t(){if(!this.wrapper){this.wrapper=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classWrapper"),true)}return this.wrapper},getFadeContainer:function t(){if(!this.fadeContainer){this.fadeContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classFadeContainer"),true)}return this.fadeContainer},getTable:function t(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classTable"),true)},getHeaders:function t(){return BX.Grid.Utils.getBySelector(this.getWrapper(),'.main-grid-header[data-relative="'+this.getContainerId()+'"]')},getHead:function t(){return BX.Grid.Utils.getByTag(this.getContainer(),"thead",true)},getBody:function t(){return BX.Grid.Utils.getByTag(this.getContainer(),"tbody",true)},getFoot:function t(){return BX.Grid.Utils.getByTag(this.getContainer(),"tfoot",true)},getRows:function t(){if(!(this.rows instanceof BX.Grid.Rows)){this.rows=new BX.Grid.Rows(this)}return this.rows},getMoreButton:function t(){var e=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classMoreButton"),true);return new BX.Grid.Element(e,this)},getLoader:function t(){if(!(this.loader instanceof BX.Grid.Loader)){this.loader=new BX.Grid.Loader(this)}return this.loader},blockSorting:function t(){var e=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));e.forEach((function(t){if(this.isSortableHeader(t)){BX.removeClass(t,this.settings.get("classHeaderSortable"));BX.addClass(t,this.settings.get("classHeaderNoSortable"))}}),this)},unblockSorting:function t(){var e=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));e.forEach((function(t){if(this.isNoSortableHeader(t)&&t.dataset.sortBy){BX.addClass(t,this.settings.get("classHeaderSortable"));BX.removeClass(t,this.settings.get("classHeaderNoSortable"))}}),this)},confirmDialog:function t(e,i,n){var s,a,r,o;if("CONFIRM"in e&&e.CONFIRM){e.CONFIRM_MESSAGE=e.CONFIRM_MESSAGE||this.arParams.CONFIRM_MESSAGE;e.CONFIRM_APPLY_BUTTON=e.CONFIRM_APPLY_BUTTON||this.arParams.CONFIRM_APPLY;e.CONFIRM_CANCEL_BUTTON=e.CONFIRM_CANCEL_BUTTON||this.arParams.CONFIRM_CANCEL;s=new BX.PopupWindow(this.getContainerId()+"-confirm-dialog",null,{content:'<div class="main-grid-confirm-content">'+e.CONFIRM_MESSAGE+"</div>",titleBar:"CONFIRM_TITLE"in e?e.CONFIRM_TITLE:"",autoHide:false,zIndex:9999,overlay:.4,offsetTop:-100,closeIcon:true,closeByEsc:true,events:{onClose:function t(){BX.unbind(window,"keydown",l)}},buttons:[new BX.PopupWindowButton({text:e.CONFIRM_APPLY_BUTTON,id:this.getContainerId()+"-confirm-dialog-apply-button",events:{click:function t(){BX.type.isFunction(i)?i():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogApply",[this]);BX.unbind(window,"keydown",l)}}}),new BX.PopupWindowButtonLink({text:e.CONFIRM_CANCEL_BUTTON,id:this.getContainerId()+"-confirm-dialog-cancel-button",events:{click:function t(){BX.type.isFunction(n)?n():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogCancel",[this]);BX.unbind(window,"keydown",l)}}})]});if(!s.isShown()){s.show();a=s.popupContainer;BX.removeClass(a,this.settings.get("classCloseAnimation"));BX.addClass(a,this.settings.get("classShowAnimation"));r=BX(this.getContainerId()+"-confirm-dialog-apply-button");o=BX(this.getContainerId()+"-confirm-dialog-cancel-button");BX.bind(window,"keydown",l)}}else{BX.type.isFunction(i)?i():null}function l(t){if(t.code==="Enter"){t.preventDefault();t.stopPropagation();BX.fireEvent(r,"click")}if(t.code==="Escape"){t.preventDefault();t.stopPropagation();BX.fireEvent(o,"click")}}},getCurrentPage:function t(){var e=parseInt(this.arParams.CURRENT_PAGE);if(BX.Type.isNumber(e)){return e}return 0},getEmptyStub:function t(){return this.getTable().querySelector(".main-grid-row-empty")},showEmptyStub:function t(){var e=this.getEmptyStub();if(e){BX.Dom.attr(e,"hidden",null);BX.Dom.addClass(this.getContainer(),"main-grid-empty-stub");if(this.getCurrentPage()<=1){this.hidePanels()}}},hideEmptyStub:function t(){var e=this.getEmptyStub();if(e){BX.Dom.attr(e,"hidden",true);BX.Dom.removeClass(this.getContainer(),"main-grid-empty-stub");BX.Dom.style(this.getTable(),"min-height",null);this.showPanels()}},showPanels:function t(){BX.Dom.show(this.getPanels());if(this.getPanels().offsetHeight>0){BX.Dom.removeClass(this.getContainer(),"main-grid-empty-footer")}},hidePanels:function t(){BX.Dom.hide(this.getPanels());BX.Dom.addClass(this.getContainer(),"main-grid-empty-footer")},getTemplateRow:function t(){var e=BX.Runtime.clone(this.getRows().getBodyChild(true).find((function(t){return t.getId()==="template_0"})));var i=BX.Runtime.clone(e.getNode());BX.Dom.prepend(i,this.getBody());var n=i.querySelector('[type="checkbox"]');if(n){BX.Dom.attr(n,"disabled",null);BX.Dom.attr(n,"data-disabled",null)}return new BX.Grid.Row(this,i)},getRowEditorValue:function t(e){this.rows=null;return this.getRows().getSelected(e).map((function(t){return t.getEditorValue()}))},getRowEditorActionPanel:function t(){if(!this.rowEditorActionPanel){this.rowEditorActionPanel=BX.Dom.create({tag:"div",props:{className:"main-ui-grid-row-editor-actions-panel"},children:[BX.Dom.create({tag:"span",props:{className:"ui-btn ui-btn-success"},text:this.arParams.SAVE_BUTTON_LABEL,events:{click:this.saveRows.bind(this)}}),BX.Dom.create({tag:"span",props:{className:"ui-btn ui-btn-link"},text:this.arParams.CANCEL_BUTTON_LABEL,events:{click:this.hideRowsEditor.bind(this)}})]})}return this.rowEditorActionPanel},showRowEditorActionsPanel:function t(){var e=this.getRowEditorActionPanel();BX.Dom.append(e,this.actionPanel.getPanel())},hideRowEditorActionsPanel:function t(){BX.Dom.remove(this.getRowEditorActionPanel())},prependRowEditor:function t(){return this.addRowEditor("prepend")},appendRowEditor:function t(){return this.addRowEditor("append")},addRowEditor:function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"prepend";BX.Dom.style(this.getTable(),"min-height",null);var i=this.getTemplateRow();this.editableRows.push(i);if(e==="prepend"){i.prependTo(this.getBody())}else{i.appendTo(this.getBody())}i.show();i.select();i.edit();this.getRows().reset();if(this.getParam("ALLOW_ROWS_SORT")){this.rowsSortable.reinit()}if(this.getParam("ALLOW_COLUMNS_SORT")){this.colsSortable.reinit()}this.hideEmptyStub();return i},hideRowsEditor:function t(){this.editableRows.forEach((function(t){BX.Dom.remove(t.getNode())}));this.editableRows=[]},saveRows:function t(){var e=this;var i=this.getRowEditorValue(true);this.emitAsync("onAddRowsAsync",{rows:i}).then((function(t){t.forEach((function(t,i){var n=e.editableRows[i];if(n){n.editCancel();n.unselect();n.makeCountable();n.setId(t.id);n.setActions(t.actions);n.setCellsContent(t.columns)}}));e.bindOnRowEvents();e.updateCounterDisplayed();e.updateCounterSelected();e.editableRows=[]}))},getRealtime:function t(){var e=this;return this.cache.remember("realtime",(function(){return new BX.Grid.Realtime({grid:e})}))}}})()})(this.window=this.window||{},BX.Event,BX.UI,BX);
//# sourceMappingURL=script.map.js